This article gives you an introduction to gizmo, the calculation language used in Orgvue.
Gizmo allows you to perform querying, calculations, aggregations and transformations on your data and save those expressions to a property for use in your analysis and visualization. Expressions can be understood as the Orgvue equivalent of Excel formulas.
Gizmo expressions can be written or stored in three different places:
- In the Gizmo editor: this is where you write and test your expression. Through the editor you can directly save your expression to the Pack for later use.
- In a pack property: when you want to save an expression for use again in a specific pack to support analysis
- In your property settings: you can store your expression at the dataset property level when you chose to 'Populate values using an expression' in the 'Manage Properties' section of your dataset
To help you decide whether to save your calculation to the Pack or Dataset, please refer to the
Where should I save my calculation? article.
Gizmo basics
An expression is built up gradually by chaining together elements such as node, properties, aggregators and methods. These elements are separated by. (dot) syntax. Consider a "." as the building block of the expression, instructing orgvue that your expression is to move on to a next step. You start with the highest level collection you can, 'node' or 'nodes()' and then you access properties or values from this collection to perform an operation. Most of your expressions will start with the word 'node' from which you build the rest of your expression:
Accessing properties
Any property in the dataset can be accessed with gizmo. There are 4 types of property you can access for a node:
- Dataset properties (e.g. node.fullname, node.grade)
- Generated properties (e.g. node._depth, node._is_orphan)
- Relationship properties (e.g. node.parent, node.child, node.sibling)
- Methods (e.g. if(), map(), filter())
Dataset properties
Any property that has been loaded into your dataset can be referenced using gizmo by calling the property key or the display name. Please note that while both the display name and the key can be used to call a property, it is recommended to use the key as the key is the first thing that gizmo looks for. When creating new properties, it is also recommended to exclude special characters from keys as this can lead to issues with the default gizmo syntax.
TOP TIP - you can use the "node['property']" syntax if you must call a property key that contains a special character.
Generated properties
Like dataset properties, any of the available Orgvue generated properties can also be used. Please refer to
What are Orgvue Generated Properties? for a list of all generated properties in Orgvue.
Relationship properties
Within a hierarchy there are relationships within the data. These relationships within the hierarchy can be queried in gizmo:
Children: node.c
Parent: node.p
Siblings: node.s
Methods
There are many methods with which you can further query and manipulate your data. Most of these can be found in the
Gizmo cookbook. This is a helpful resource that provides additional guidance on the expressions you can build. It is recommended to always have the cookbook open when you work with expressions. It can also easily be accessed in the Gizmo editor itself.
Video example
In this video we show you how to open the expression window and write a calculation to get the manager's position title.
Comments
0 comments
Please sign in to leave a comment.