Expressions
The Builder and Ioto uses JavaScript like expressions throughout the system to provide user control of processing and the app UI.
These expressions are used in the following contexts:
- View.enable expression
- Widget show expression
- Software update policy expression
- Automated action if/then/else expression
The View.enable expression is used to enable or disable a view.
The Widget.show expression is used to determine if a widget should be displayed.
The Software Update Policy expression is used to determine if a software update should be applied to a specific device.
The Automated Action expression is used to determine which set of parameters should be provided to the automated action.
Expression Context
The expression is a JavaScript style expression that will resolve to a boolean result. For example:
value > 0
(width < 640 && width < 1024) && language == /en/
Other context variables include. Note that some of these are only available in certain contexts:
Variable | Description |
---|---|
agent | Browser user agent string |
dark | True if in dark mode |
desktop | True if running on a desktop PC |
framed | True if the board is framing widgets |
full | True if the board is in full screen mode |
height | The browser width dimension (navigator.innerwidth) |
language | The configured browser language (navigator.language) |
live | True if the dashtop has enabled live data updates |
mobile | True if running on a mobile device (<= 640px width) |
value | The widget data (or input) value |
width | The browser height dimension (window.innerWidth) |
The query language supports the operators:
+ - * / ( ) ^ ! % == != < <= > >= ^= ^!= $= $!= << >> && || <> ><
These extension operators have the following meaning:
- a ^= b means a starts with the string b
- a ^!= b means a does not start with the string b
- a $= b means a ends with the string b
- a $!= b means a does not end with the string b
- a >< b means a contains the string b
- a <> b means a does not contain the string b
Sub-expressions can be grouped with parenthesis and the boolean operators && and || can group conditional operands.
Regular expressions (delimited by slashes) may be used with the "==" and "!=" operators. The regular expression can be on either side of the operator.
The expression language understands the types: Numbers, Boolean, String literals, Regular Expressions and null.
The expression is run-time limited to evaluate up to 50 terms. This is to protect your cloud against denial of service attacks.