Conditional execution (IF)
The command allows running a command or a sequence of commands under certain conditions. The command is executed when the expression is true . One may also run a sequence of commands enclosed in a BEGIN / DO - END block. The complete IF statement including command or BEGIN / DO has to be defined on a single line.
Parameters:
- expression - The OSI expression defines the condition to be checked before running the command(s). The expression must be a valid OSI expression. When the expression contains special characters it must be put into quotes or apostrophes.
- command - The command to be executed when the condition ist true . For processing a block of statements one may use CALL for running a pre-defined procedure or a BEGIN / DO - END block.
- -Dn - re-direction to other data source.
- -Cn - re-direction to other collection in the hierarchy or in the data source referenced by -Dn.
Syntax:
if expression command -Dn - Cn
Examples:
if "age > 20" p name // Show value for 'name' when age > 20
if "age > 20" do // Show value for 'name' and 'age' when age > 20
p name
p age
end