Calculated properties
Synopsis
Calculated properties allow you to add or remove properties to a variable or a family depending on the context.
Here is the list of editable properties:
Attribute applying to |
Property’s name |
Comment |
|---|---|---|
Variable Family |
hidden |
Hides a variable or a family, in this case it is not accessible in See also |
Variable Family |
disabled |
Deactivates a variable or family, in this case it is never accessible. See also |
Variable |
frozen |
A frozen variable is a variable that the operator cannot change the value. |
Variable |
mandatory |
The variable expects a value other than See also for non multiple variables we call it a nullable variable. |
Variable |
empty |
The multiple variable allow the value See also we call it a nullable variable. |
A property can be calculated. In this case we have two possibilities:
calculation via Jinja (see also the tutorial with a real world sample variable jinja)
calculation via a variable (see also the tutorial with a real world sample variable calculation)
Parameters
Variable parameters
Parameter |
Comment |
Sample |
|---|---|---|
type
|
Calculation type. This parameter is optional. It is deduced from the presence of the parameter “variable” in a calculation. |
variable |
variable
|
Name of the associated variable. It’s better to use relative path notation. |
_.my_variable |
when/when_not |
Compare the value of the variable define in If the related variable is the boolean typed variable, the default value is |
See the tutorial with a real world sample when_not) |
propertyerror
|
If access to the variable is not possible due to a property
(for example Default value: |
transitive false |
optional
|
The variable in calculation may not exist. This generates an error. Overall coherence is not guaranteed.
To avoid this set the optional parameter to |
true |
default
|
If optional parameter is set to |
false |
description
|
Rougail engine create a description like “when the variable “xxxx” has the value “yyyy”. You can personnalize here the calculation description |
Jinja parameters
Parameter |
Comment |
Sample |
|---|---|---|
type
|
The calculation type. This parameter is optional. It is deduced from the presence of the parameter “jinja” in calculation. |
jinja |
jinja
|
Jinja template. For a multiple variable, each line represents a value. It’s better to use relative path notation in Jinja template. |
{% if _.my_variable %}
{{ _.my_variable }}
{% endif %}
|
params
|
Additional parameters passed to the Jinja template See below to have params possibility. |
See the tutorial with a real world sample params) |
return_type
|
Jinja template could return two type of value:
|
See the tutorial with a real world sample return_type) |
description
|
Rougail engine cannot deduce what you want to do in Jinja template. You have to describe it for documentation purpose.
If return_type parameter is |
See the tutorial with a real world sample description) |
In the case of a Jinja type calculation, it is possible to have parameters (params).
There are two types of parameter:
the standard parameters (string, boolean, integer, null), in this case just do: “key: value”
advanced settings:
parameter via a variable
parameter via information
parameter via an identifier: in the case of a variable in a dynamically built family
parameter via an index: in the case of a variable in a sequence
parameter via the current namespace
Parameters for variable type param
Parameter |
Comments |
Sample |
|---|---|---|
type
|
Parameter’s type |
variable |
variable
|
Variable’s name It’s better to use relative path notation. |
_.my_variable |
propertyerror
|
If access to the variable is not possible due to a property (for example Default value: |
false |
optional
|
The variable may not exist depending on YAML file imports. If the optional parameter is true, the parameter will simply be deleted if the variable does not exist.
Default value: |
true |
whole
|
In sequence family, only the value of the variable in the current element is propose. This parameter allow you to have all values for all elements. Default value: |
true |
Parameters for information type param
Parameter |
Comments |
Sample |
|---|---|---|
information
|
Name of the information whose value we want to retrieve. |
doc |
variable
|
Variable’s name. If not specified, the information is retrieve in Tiramisu Config. It’s better to use relative path notation. |
_.my_variable |