38
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 variable type
[[see types]]
.)
On the other hand, if the "(expression)" option is CHECKED, the CRM-WIC will treat the values as
expressions and evaluate them before matching on a trigger 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
Evaluation of Expressions
Expressions are evaluated strictly left-to-right, and 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 is 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.
Hello+3 7
Assuming
Hello
is a variable holding a value of
4
, a
number.
3+"6" 9
The string
"6"
is valued as
6
, a number, because
3
is
a number.
3+"Hello" 3
The string is treated as
0
because
"Hello"
has no
integer interpretation.
Содержание CRM-WIC
Страница 1: ...Reference Manual Programming Guide Room Monitor Web Intelligent Controller Model CRM WIC...
Страница 7: ...7 Box Contents Box Contents for the CRM WIC Web Intelligent Controller Model CRMWIC Power Adapter...
Страница 8: ...8 Hardware User Interface Hardware User Interface for the CRM WIC...
Страница 16: ...16 For full details see the RPC section at the end of this manual...
Страница 43: ...43 This expression resolves to this value 0 1 4 3 1 Hello Hello 0...
Страница 98: ...98 Index...