Token Expressions
Token expressions are special expressions typically consisting of some combination of objects (or object variables), properties, and methods. These elements are chained together using periods in what is commonly referred to as dot notation. Using token expressions, it is possible to dynamically access logically-linked values and object references without having to hardcode this information.
Any object properties, including custom properties, can be accessed using token expressions. Additionally, datatypes with methods, such as Strings and Lists, can also be used in token expressions.
Syntax |
Result |
|
The value of the property of the object with ID |
|
The value of the property with ID |
|
The result of calling |
Examples
myKpi := t.KPI001 // A KPI object
myKpi.responsible // User object-reference of the Users (list) responsible for the KPI
myKpi.responsible.first().email // The email of the first responsible User of the Kpi
myInitiative := t.305 // A Strategic Initiative object
myInitiative.startDate // The Start Date for the Initiative
t.myInitiative.tasks // All the tasks underneath the Initiative
t.myInitiative.tasks.filter(approved) // All the tasks underneath the Initiative that are approved = true
// for boolean properties, explicity writing = true is not needed
Caution
Properties can only be accessed from individual objects and will not work when called on a list of objects.
In line 3 of the code above, responsible
is a multi-user reference property,
meaning that it resolves to a list of Users. The first()
method is used to get an individual User,
prior to trying to access the email
property.
Tokens and Context
Tokens do not require a hardcoded object reference, and can instead be written with a Context object. This can make code much more dynamic and reusable.
Examples
this.object.id // The id of the currently selected object
this.object.parent.parent // The parent object of the parent of the currently selected object
this.organisation.name // The name of the context organisation
List Token Expressions
There are various special token expressions that resolve to a list of objects. These can be used for getting: children objects, children objects of a particular type, ancestor objects, and more. In most cases, these expressions show only the top-level children and not any nested children.
Expression |
Return Value |
|
List with the first-level child objects |
|
List with all the child objects |
|
List with the first-level child organisations |
|
List with the child Scorecard objects |
|
List with the child Perspective objects |
|
List with the child Strategic Objective objects |
|
List with the child KPI objects |
|
List with the Strategic Initiative objects that affect the current object |
|
List with the child Risk Assessment objects |
|
List with the child Indicator objects |
|
List with the child Task objects |
|
List with all descendent objects that have a status value |
|
List of all the file resources within the current context |
|
List of all descendent file objects |
Examples
this.object.children // Returns a list with all the first level children of the object
this.object.descendents // Returns a list with all the children (including children of children)
this.organisation.organisations // Returns a list with all the first level children organisations