Operators
Supported Operators
The following categories of operators are supported:
- Arithmetic Operators: These operators are strictly used with numeric operands.
- Boolean Operators: These operators are used for operands that yield BooleanUses AND, OR, and NOT as operators between expressions to produce results based on whether the complete expression is true or false. Also called logical. values (for example, values from logical fields, values from relational comparisons, etc.).
- Relational Operators: These operators are used with numeric operands for numerical comparisons. If one or both of the operands contain a string value, the type of comparison is instead based on lexicographical ordering.
- Equality Operators: These operators are used for testing for (non)equivalence for Boolean, DateTime, numeric, and text values.
The operators supported in HEAT are:
Category | Name | Operator |
---|---|---|
Arithmetic | Addition | + |
Arithmetic | Subtraction | - |
Arithmetic | Multiplication | * |
Arithmetic | Division | / |
Arithmetic | Remainder | % |
Boolean | NOT | ! |
Boolean | AND | && |
Boolean | OR | || |
Relational | Less Than | < |
Relational | Greater Than | > |
Relational | Less Than or Equal | <= |
Relational | Greater Than or Equal | >= |
Equality | Equal | == |
Equality | Not Equal | != |
Operator Precedence
The following table illustrates the order of precedence of the operators, from highest to lowest precedence.
Operators in the same row have the same precedence, which are evaluated from left to right, based on the appearance of the operators in the expression.
Category | Operators |
---|---|
Boolean NOT | ! |
Multiplicative | * / % |
Additive | + - |
Relational / Equality | < > <= >= == != |
Boolean AND | && |
Boolean OR | || |
You can use parentheses to control precedence and associativity. When you save an expression, if you did not specify parentheses, the system automatically adds additional parentheses.
For example, if you enter the following expression:
$(3 + 4 * 5)
When you save it, the system displays the expression as:
$(3 + (4 * 5))
This is consistent with the order of precedence as shown in the previous table.
The Boolean operators (||, &&) support short circuiting:
- For expressions like $(<Expr1> || <Expr2>), if <Expr1> evaluates to true, then <Expr2> is not evaluated.
- For expressions like $(<Expr1> && <Expr2>), if <Expr1> evaluates to false, then <Expr2> is not evaluated.
For the Boolean AND (&&) and Boolean OR (||) operators, while defining the expression, you can opt to specify the operators as AND or OR, respectively. The system automatically converts them to && or || when you save the expression.
For example, if you define the iif() expressions as:
$(iif(
<Expr1> AND <Expr2>,
…
))
$(iif(
<Expr1> OR <Expr2>,
…
))
The system saves the respective expressions as:
$(iif(
<Expr1> && <Expr2>,
…
))
$(iif(
<Expr1> || <Expr2>,
…
))
HEAT recognizes the following binary operators:
+ - * / = == != < > <= >= && ||
For example:
iif( ((Status == "Closed") || (Status == "Denied")), true, false)
This conditional expression can be found as a read-only condition in the layout editor. If the value returned is true, then the status is closed and the form field becomes read-only. If the value returned is false, then the status is denied.
You can also use AND and OR instead of && and ||. |
For example, when constructing an operator in the If block of the workflow designer, you can use binary operators:
1. | Enter a title in an If block. An example is Need additional approval. |
2. | Select the OR radio button. |
3. | Select a field as an operand. An example is Type of change. |
4. | Apply an additional operator. An example is Not equal to (<>). |
5. | Select a value. An example is Standard. |
Based on the outcome of this expression, the exit port of the If block can connect to a different block, creating a different path within the workflow.
A conditional expression is a powerful tool that can be used in several administrator module components, such as business rules, form controls, and toolbar controls.
You can enter conditional expressions using the iif statement in the following syntax:
iif(condition, whenTrue, whenFalse)
Only one of the whenTrue, whenFalse expressions is evaluated and returned based on the outcome of the condition. For example:
$(iif(((Status == "Resolved") || (Status == "Closed")), false, true))
This expression is used in a read-only business rule. The rule has been set to be conditionally read-only based on the expression. If the status is closed, the item becomes read-only.
iif is case sensitive. For example, if your value is "Resolved", then the return value is also "Resolved", and not "resolved" or "RESOLVED". |