Gizmo editor
The Gizmo editor is useful for evaluating expressions on the fly
It is a great way of testing whether your expression is valid, or calculating something without having to create a property in the Dataset or Pack
To access the Gizmo editor in Workspace:
- Select the
Gizmo editor
button - This will open the Gizmo editor window
- Enter the expression into the expression panel of the editor
- Select
Run
to evaluate the entered expression - If the expression is valid then the results of the expression will be returned in the Results Pane of the editor
- Results will be returned for the selected node(s)
- Once an expression has run it may be Saved to a pack If it returns a single number, string, date or boolean. Alternatively if the expression is to be used in multiple packs can also be saved to the dataset as a new property
Some practical tips:
Results that are returned
- If a single Node is selected then the editor will return the result for the selected Node
- If multiple Nodes are selected then the editor will return the result for the Node in the first position in the sort order (this will not necessarily be the first Node in the selected Node list)
- If no Nodes are selected then the editor will return the result for the root Node
- If there are no Nodes selected and there are multiple roots then the editor will return the result for the root in the first position in the sort order
Results pane
When an expression is evaluated, the results will be returned in the results pane
Result types:
A collection of Nodes
A collection of Values
- Numbers
- Strings (text)
- Dates
- Boolean (true, false)
A single Value
This is also where error messages occur. E.g. “Parse Error…” means you have made a syntax mistake in the expression
Saving expressions to a pack
Once an expression has been successfully evaluated clicking "Save as property" will open the Save property
window
This will enable you to save your expression to a new property which will be stored in your Pack
- The expression you created in the Gizmo editor will be automatically entered into the Expression box
- Property Name: Enter the name to be displayed for property in pack
- The key will be automatically populated using the property name. The Key cannot have spaces therefore any spaces in the Property Name will be replaced with an underscore (
_
) The Property Key may be overwritten if required - Select the property Data type. Orgvue will auto populate this but it can be changed
Select calculation mode
Auto
- On Demand
- Pre Filter
- Post Filter
Calculation Mode
Calculation Mode | Behaviour |
---|---|
Auto | Auto operates in the same way as Post Filter, the expression results depend on any active Filters and evaluation occurs whenever data are edited or when the Filter is changed |
Pre-Filter | The expression will ignore any Filtering or Paging that is applied. The expression will be re-evaluated whenever data are edited |
Post-Filter | The 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 Demand | The 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 in the context of the active Filter and Paging |
Saving expressions to a dataset
If a saved expression is to be used across multiple packs from the same dataset it is more efficient to save the expression as a property in the dataset rather than a pack property
To populate property values using an expression, first follow the steps to Add a New Property then:
- Select the Values Tab
- Select the
Populate values using an expression
checkbox - Enter the Gizmo Expression into the expression window
- Select the required Property expression mode
- Select the required Property evaluation mode
- Select
Save
Property Expression Mode
The expression mode determines when a Gizmo expression will be run for the property value for a node
Expression Mode | Behavior |
---|---|
Empty Cells | If the cell has no value, populate the data with the value returned from the expression |
New Nodes | When 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 unless triggered via On Demand |
All Nodes | The 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 Mode | Behavior |
---|---|
None | The Expression will be treated as a literal value, returned as entered in the Expression box |
Pre-filter | The expression will ignore any Filtering or Paging that is applied. The expression will be re-evaluated whenever data are edited |
Post-filter | The 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 Demand | The 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 in the context of the active Filter and Paging |
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 Mode | Empty Cells | New Nodes | All Nodes |
None | The 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 save | The 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 save | The expression will be printed to populate the property's cells, regardless of whether the cell carries a persisted value or not |
Pre-filter | The expression will be run before the data is filtered for a visualization and this will populate the property's cells | The 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 dataset | The expression will be run before the data is filtered for a visualization and this will populate the property's cells |
Post-filter | The expression will be run after the data is filtered for a visualization and this will populate the property's cells | NA (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 Demand | The expression will be run after the data is filtered for a visualization and this will populate the property's cells. The values will be saved to the dataset after the expression is run. Will only populate blank values in the property | NA (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. The values will be 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 |
Default Boolean Value
It is possible to define a default value for Boolean
properties for all nodes
This default value may be then be edited for nodes where required
Properties may be set to default to either True of False using this formula
(defaultValue => true)()
or
(defaultValue => false)()