SET ​
Set the value of a variable.
Syntax ​
leo-grammar
SET VariableName:VariableValue .
VariableName : LowerCaseIdentifier .
VariableValue : anyValue .
Parameters ​
VariableName
(LowerCaseIdentifier) - The name of the variable to set.VariableValue
(anyValue) - The value for the variable.
Details ​
The SET
command allows to create new variables or overwrite the value of existing variables. It sets the variable to the value specified after its identifier VariableName
. The value can be of any supported type and can be a literal or an expression. See LEO literals and expressions for further details.
See Also ​
Examples ​
A Notebook where the attribute "Parallel" is enabled based on certain amounts of different triggers. The SET
command is used in this case to simplify some of the enabled
checks for the attribute.
leo
NOTEBOOK
AVAL sTyp:"Type"
AVAL sMes:"Message"
AVAL sTim:"Timer"
AVAL sCon:"Conditional"
AVAL sSig:"Signal"
AVAL sEsc:"Escalation"
AVAL sErr:"Error"
AVAL sCom:"Compensation"
# Count how many of the triggers are set (top-level, non-interrupting and interrupting)
SET topcnt:(cond(sMes = "Yes", 1, 0))
SET topcnt:(cond(sTim = "Yes", topcnt+1, topcnt))
SET topcnt:(cond(sCon = "Yes", topcnt+1, topcnt))
SET topcnt:(cond(sSig = "Yes", topcnt+1, topcnt))
SET nonintercnt:(cond(sEsc = "Yes", topcnt+1, topcnt))
SET intercnt:(cond(sErr = "Yes", nonintercnt+1, nonintercnt))
SET intercnt:(cond(sCom = "Yes", intercnt+1, intercnt))
CHAPTER "General"
ATTR "Name"
ATTR "Show name" ctrltype:check unchecked-value:"no" checked-value:"yes"
ATTR "Order"
ATTR "Description" lines:5
ATTR "Comment" lines:5
ATTR "Open questions" lines:5
CHAPTER "Event type"
ATTR "Type" ctrltype:radio # Top-level, Event Sub-Process (non-interrupting), Event Sub-Process (interrupting)
GROUP "Trigger"
ATTR "Compensation" ctrltype:check unchecked-value:"No" checked-value:"Yes" enabled:(sTyp = "Event Sub-Process (interrupting)")
ATTR "Conditional" ctrltype:check unchecked-value:"No" checked-value:"Yes"
ATTR "Error" ctrltype:check unchecked-value:"No" checked-value:"Yes" enabled:(sTyp = "Event Sub-Process (interrupting)")
ATTR "Escalation" ctrltype:check unchecked-value:"No" checked-value:"Yes" enabled:(sTyp != "Top-level")
ATTR "Message" ctrltype:check unchecked-value:"No" checked-value:"Yes"
ATTR "Signal" ctrltype:check unchecked-value:"No" checked-value:"Yes"
ATTR "Timer" ctrltype:check unchecked-value:"No" checked-value:"Yes"
ENDGROUP
GROUP "Multiple trigger"
ATTR "Parallel" ctrltype:check unchecked-value:"No" checked-value:"Yes"
enabled:(((sTyp = "Top-level") AND (topcnt > 1)) OR
((sTyp = "Event Sub-Process (non-interrupting)") AND (nonintercnt > 1)) OR
((sTyp = "Event Sub-Process (interrupting)") AND (intercnt > 1)))
ENDGROUP
Versions and Changes ​
Available since ADOxx 1.3