Skip to main content

Expressions

Expression Propertiesโ€‹

When adding new properties or editing existing properties, it is possible to include expressions to create calculated properties to populate values

This may range from simple mathematical calculations that add two properties together to provide a sum, through to more complex logic based transformations of data

Expressions in Orgvue are written in Gizmo, a scripting language that has its roots in JavaScript but has been added to and modified by the Orgvue development team

For further detail on Gizmo expressions see the Gizmo Cookbook

image

To populate property values using an expression, first follow the steps to either Add a New Property or Edit an existing property

  1. Select the Values Tab
  2. Select the Populate values using an expression checkbox
  3. Enter the Gizmo Expression into the expression window
  4. Select the required Property expression mode
  5. Select the required Property evaluation mode
  6. Select Save

Property Expression Modeโ€‹

The expression mode determines when a Gizmo expression will be run for the property value for a node

Expression ModeBehavior
Empty CellsIf the cell has no value, populate the data with the value returned from the expression
New NodesWhen a new node is created, populate the cell with the value returned by the expression The expression will only run on the creation of a node
All NodesThe expression will be evaluated for all Nodes, regardless of whether a Cell stores a value of not. The Cells are not editable within Workspace

Property Evaluation Modeโ€‹

The Evaluation mode determines how the expression will work

Evaluation ModeBehavior
NoneThe Expression will be treated as a literal value, returned as it is entered in the Expression box
Pre-filterThe expression will ignore any Filtering or Paging that is applied. The expression will be re-evaluated whenever data are edited
Post-filterThe expression results depend on any active Filters and evaluation occurs whenever data are edited or when the Filter is changed You cannot Filter or Page on a Post-Filter (or Hierarchy) evaluated Property
On DemandThe expression will be evaluated when you activate it in Workspace, and not automatically following edits. The return value of the expression will be saved to the Cell. An On Demand expression is always evaluated Pre Filter
important

Expressions may be Evaluated either pre or post filter which is only possible within Orgvue Workspace. Therefore any saved expression property values will not be available if using the Settings Download Dataset option to export your dataset. To include expression property values in your data export use the Export Canvas to CSV option

Expression and Evaluation mode relationshipโ€‹

The selection made for Expression and Evaluation modes work together to provide different outcomes

This table describes the relationship between the various options

Expression Mode
Evaluation ModeEmpty CellsNew NodesAll Nodes
NoneThe value will be interpreted as a literal, printed to populate the property's cell if that cell does not otherwise carry a value. The default value is not persisted on saveThe value will be interpreted as a literal, populating the property's cell if no other value was presented at creation time. The value is persisted on saveThe expression will be printed to populate the property's cells, regardless of whether the cell carries a persisted value or not
Pre-filterThe expression will be run before the data is filtered for a visualization and this will populate the property's cellsThe expression will be run on node creation, independently of filtering, and the return value will populate the property's cell. The output will be saved after the expression is run in the datasetThe expression will be run before the data is filtered for a visualization and this will populate the property's cells.
Post-filterThe expression will be run after the data is filtered for a visualization and this will populate the property's cellsNA (evaluation of New Nodes value is always pre-filter)The expression will be run after the data is filtered for a visualization and this will populate the property's cells
On DemandNA (On Demand expression will run for all nodes)NA (evaluation of New Nodes value is always pre-filter)The expression will be run when manually triggered with evaluation done pre filter and this will populate the property's cells. The values saved to the dataset after the expression is run Will be applied to all property values regardless of whether they are already populated or not

Run On Demand Expression on Saveโ€‹

An alternative to running on demand expressions manually is to enable the calculation to run every time the dataset is saved

This option can be enabled within the Property Manager by:

  1. Select the required property
  2. Select the Values tab
  3. Enter the expression to be calculated
  4. Select the calculation to run On-Demand
  5. Select which roles will run the On-Demand calculation on saving the dataset
  • a. Admins
  • b. Users

alt text

With these options selected when the dataset is saved the On-Demand calculation will run automatically and update the values contained within it

alt text