Basic grammar and elements

An expression is built up gradually by chaining together elements such as node, property, filter, groupBy and other aggregators and methods

These elements are separated by . (dot) syntax

You start with the highest level collection you can, 'node' or 'nodes()' and then you access properties or values from this collection to define a subset of the data on which to perform an operation.

Every time you add something after a dot ('.') it is acting on the input data specified before the dot. For example,

Grammar

  1. Returns the collection of nodes
  2. Returns their current salaries
  3. Returns the sum of current salaries from the collection of nodes

Grammar in the editor

Accessing properties

Any property in the dataset can be accessed (and then manipulated) by using this syntax – including metadata and relationships, as well as normal dataset properties.

There are 4 types of property you can access for a node:

  1. Dataset properties (e.g. node.fullname, node.grade)
  2. Generated properties (e.g. node._depth, node._is_orphan)
  3. Relationship properties (e.g. node.parent, node.child, node.sibling)
  4. Methods (e.g. if(), map(), filter())

Dataset properties

The most common collections to follow node. or nodes(). are data properties, e.g. node.fullname will return a value stored in the 'Full Name' property for a node

Dataset properties come in 4 types:

  1. Number (measure)
  2. Text (string/dimension)
  3. Date (temporal/dimension)
  4. Boolean (yes/no; true/false)

More exotic types are also supported, including functions, arrays and objects

The data type of a property affects the range of methods that can be applied to it, e.g. you can’t average a string (text)

Note: Typing node. in the expression panel will list all of the data properties in the dataset.

Generated properties

These are properties that Orgvue generates automatically

These properties describe the node itself, and are present as options in a dataset regardless of what other data it contains

Generated properties may be identified in Orgvue property selectors as the ones in italics and a may be called in an expression using the underscore _ before the property name e.g. _depth

generated properties

Example: node._is_orphan will return a value of true or false, and node._depth returns the depth of the currently selected node (for more information on generated properties, see Generated properties

Relationship properties

Node relationships are stored as a special type of property. This allows you to reference nodes through their hierarchical relationships to one another.

Syntax Results
node.parent or node.p Returns the parent (or manager) of the selected node
node.siblings or node.s Returns all nodes under the same parent node (team members)
node.children or node.c Returns all children (direct reports) of the selected node
node.ancestors or node.a Returns all nodes on the path from the node to root ( Parent, Grand Parent, Great Grand Parent etc)
node.descendants or node.d Returns descendants (all direct and indirect reports) for the selected node
node.d(2) Returns all descendants starting two levels below the selected node
node.d(1,2) Selects all descendants between 1 and 2 levels below the selected node
node.d(0,2) Returns the node itself and all descendants starting two levels below

Note: These expressions will perform calculations on the filtered sub-set of your data after any filters have been applied. Putting an 'a' or 'all' before relationship properties, e.g. ac or allChildren, as or allSiblings, ad() or allDescendants will return those relations regardless of any filters applied to the dataset.

Descendants node.d() and node.d(n,n) should never be used in expressions that will be saved to a pack or dataset as they are very expensive to run and will erode you and your stakeholder's Orgvue experience

See Hierarchical aggregation to understand how to carry out calculations using the whole hierarchy.

Methods

There are a number of methods which allow you to further manipulate the accessed collection.

The . (‘dot’) syntax is used to call methods on a collection.

The methods have ( ) after them. The brackets contain the expression's ‘arguments’ - that is, the input upon which it acts

e.g. List everyone without a manager or reports nodes().filter(is.orphan)

results matching ""

    No results matching ""

    results matching ""

      No results matching ""