Expressions
Expressions in CommandCenter can be used either as a test in a logic block or as a result for an assignment. They are similar to formulas in a spreadsheet. The expression editor allows a number of operators to be used to produce the required results. The table below outlines the supported operators which the expression parser currently supports.
Operator |
Alternative Operator |
Function/Description |
---|---|---|
+ | addition (numerical values and string) | |
- | subtraction (numerical values only) | |
* | multiplication (numerical values only) | |
/ | division (numerical values only) | |
% | modulus (numerical values only) | |
== | equals to (numerical values and string) | |
=< | <= | less than or equal to (numerical values and string) |
=> | >= | greater than or equal to (numerical values and string) |
<< | Shift numerical value left by ‘n’ bits (numerical value) | |
>> | Shift numerical value right by ‘n’ bits (numerical value) | |
~ | Invert (numerical values only) | |
^ | exclusive OR (numerical values only) | |
! | != | not equal (numerical values or strings) |
& | binary AND (numerical values only) | |
| | binary OR (numerical values only) | |
&& | AND | logical AND |
|| | logical OR | |
NOT | logical NOT |
In the expression parser it will equate the parts of the expression as a number unless you tell it that you want it to interpret it as a string. To do this you have to put double quotes around it. For example, to test if a panel variable contains a string “Bob:”
“PANEL_VARIABLE” == “Bob”
If multiple operators exist in an expression, and the order of processing of these are important to the evaluation of the expression then parenthesis can be used to control this order of evaluation. For example:
This will multiply the INPUT by 9 first, then divide the result by 5 and then finally add 32.
When using a variable, expression or functions to the expression the ‘Add’ button MUST be used as this will generate the correct syntax for these keywords. The expression editor contains a test mode that allows an expression to be tested with dry run data in the designer, prompting the user for any ‘unknown’ values used in the expression.