Expressions in Default Values
Default values may contain expressions.
When a default value contains an expression, note that expressions can also use other variables. You can reference a variable with the following syntax:
Scope | Variable Syntax |
---|---|
Application | $application.variables.<variableName> |
Page | $page.variables.<variableName> |
Action Chain | $chain.variables.<variableName> |
Expressions must be wrapped in expression syntax :{{ expr }}
. and the expression must be the entire value. Expressions can also call external functions via the page function module.
To reference another variable in a default value, you can do the following:
"nameOfVariable": { "type": "application:myType", "defaultValue": { "foo": "{{ $application.variables.someOtherVariable }}" } }
Since these are expressions, you can also add simple Javascript code to the values:
"myOtherVariable": { "type": { "someBoolProperty": "boolean" }, "defaultValue": { "someBoolProperty": {{ $application.variables.someOtherVariable === true }}" } }