Expressions
Trigger Values for Events and Output Values for Actions may be written as expressions (instead
of constant values) by checking the “(expression)” flag. Evaluating expressions is described in
this section.
Interpreting Values as Expressions
If the “(expression)” option is UNCHECKED, the trigger and output values are treated as simple strings,
and no quotation marks are needed. (NOTE: Variable Events and Actions automatically interpret the
value based on its output or input Variable’s type (see Types of Variables, page
).
On the other hand, if the “(expression)” option is CHECKED, the WACI will treat the values as an
expression and evaluate them before triggering or sending an output.
In an expression, any string values must now be in quotes; otherwise, the token will treated as an
identifier. For example:
•
“Hello”
(in quotes) is a string value in the expression.
•
Hello
(without quotes) is an identifier for a Variable.
Special characters inside string values (inside quotes) must be escaped (see Escaping Special Characters,
) or URL encoded (see Send String, page
).
Evaluation of Expressions
Expressions are evaluated strictly left-to-right. Order of operations is NOT supported; however,
parentheses may be used to prioritize the execution of the expression.
In addition, the type of operation (string, integer, etc) and the final value of the expression are determined
by the first token. If a string cannot be resolved to an integer during an integer operation, it takes on the
value of
0
(zero).
Some examples:
This expression...
... resolves to this
value.
Notes
3+4*5
35
No order of operations.
3+(4*5)
23
Priority is indicated by
parentheses.
“Hello”*3
“HelloHelloHello” *
is a string operator here.
“Hello”+3
“Hello3”
The number
3
becomes
part of the
“Hello”
string
because the string comes
first.