Expression Builder Language Elements

Note:
  • The syntax is not case sensitive, however, it is highly recommended to use the casing presented in the auto-complete lists.
  • For common usage of Arithmetic and functions and Constants reference MS .NET / C# online documentation.
Language Element Notes Supported formats/values/examples
Arithmetic operators (in order of precedence)  
  Exponentiation ^
Unary negation
Multiplication and floating-point division *, /
Integer division \

Modulus arithmetic

(Returns the remainder after a number is divided by a divisor. The result always has the same sign as the divisor.)

MOD
Addition (string concatenation) and subtraction +, –
Comparison operators    
 

     Equals (this works when comparing strings)

=
     Not Equal (this works when comparing strings) <>
     Less Than <
     Less Than or Equal <=
     Greater Than >
     Greater Than or Equal >=
Logical and bitwise operators    
 

Negation

Note: The Negation (NOT) operator only supports logical operations, and does not support bitwise operations.
NOT
Conjunction AND
Inclusive disjunction OR
Exclusive disjunction XOR
Comment    
 
Note: Since only syntactically valid expressions can be saved, there is the possibility to comment out sections for editing them later. If you want to comment out an expression, some dummy value can be provided before the comment, for example:
"1 // Math.Max(Math.Sin($myTag)*1, 12)"

// Comment

 

Constants    
Note: For a list of all Constants, and a description of each, use the Constant button in Expression Builder and see the relevant tooltip.
  Epsilon  
False  
NaN  
NegativeInfinity  
Null  
PositiveInfinity  
Pi  
True  
Functions    
 
Note: For a list of all functions with descriptions, use the Function button in Expression Builder and see the relevant tooltip.
  • Math.Sin(pi)
  • String.Concat("a","b","c")
Parentheses    
 
Note: [ ] and { } are not supported
2*(3+4)
Arrays    
 

Arrays can be constructed using the ArrayOf and ListOf functions, and the ItemAt function can be used to access elements of an array.

Note:

When an "ItemAt($index, $array)" function is constructed in the Expression Builder, it will only update the returned value when the value of the "$index" tag changes, or a new array is assigned to the "$array" tag.

The following C# script statements illustrate how to trigger a value change event:

$index++;
$array = { "one", "two", "three" };

The following C# script statement will not trigger a value change event:

$array[1] = "new value";

The following example illustrates how to access elements of an array, using simple syntax:

ItemAt($tag_testInt, ListOf(0, 10, 20, 30, 40, 50))
// Place in the binding for the value of a Label
// Then by changing the value of the tag from 0 to 5, the value of the label will change from 0 to 500
String Literals    
 

Supported escape sequence for strings:

"sample Bob's name"
  • "Bell (alert): \a"
  • "Backspace: \b"
  • "Formfeed: \f"
  • "New line: \n"
  • "Carriage return: \r"
  • "Horizontal tab: \t"
  • "Vertical tab: \v"
  • "Single quotation mark: \'"
  • "Double quotation mark: \""
  • "Backslash: \\"
  • "Unicode char in hexadecimal notation: \u0020"
Tag Reference    
   
  • $myTagName
  • $System.Users.CurrentUsername
White Space    
 

Extra white space, if not part of a string, is ignored.

Operators do not need white space, but it may be useful for readability.

You may press <enter> and continue an equation on the next line.

You may not press <enter> and continue a string onto a second line.

The example below illustrates the valid use of multiple lines:

if($tag4,
"evaluated as true",
"evaluated as false")

//example:  invalid use of multiple lines
" this 
string  cannot  be on two lines"