Access to data fields in calculation expressions
Values can be read from data fields of the input object ($input) via curly brackets {}. The data field can also be specified as a path. Individual data fields in the path are separated from each other with '.' (e.g. {data fieldFirstLevel.data fieldSecondLevel.data fieldThirdLevel} ).
Tip: For list elements, the index (starting with 0) can be specified as the data field name. e.g. data fieldTheList.3 → Reads the fourth entry of the list.
The input data of a calculation can be accessed via the constant $input and depends on the respective application.
For example, if it is a label expression for a data grid cell, the input data is the object of the whole row.
In the case of a calculated behaviour in the form designer, this is the data of the trigger. Usually, however, this can be found in the respective manual entries.
Example for the access to data fields of the input object:
The following input object is given:
{
"type"
:
"Fahrer"
,
"person"
: {
"firstName"
:
"Jonas"
,
"lastName"
:
"Abend"
},
"vehicle"
: {
"types"
: [
"LKW"
,
"CAR"
]
}
}
A text representation of the object is now to be inferred in the calculation expression:
{type}: {person.firstName} {person.lastName} (Fahrzeugtyp: {vehicle.type.0})
The result of the evaluated expression with the data shown above as an input object is:
'Driver: Jonas Abend (whicle type: Truck)'.
►NOTE◄ In the last example shown, it is also easy to see that any words outside the expression brackets are not evaluated, but are directly included in the result.