Criteria in conditional statements
Table of Contents
Overview
A criteria is required when you need to execute conditional statements like if, else if, and conditional if. Criteria comprises of one or more conditions separated by logical operators.
Conditions always evaluate to a boolean value - True or False. The boolean value of the overall criteria will depend on the conditions and the type of Logical Operators used to connect the conditions in the criteria.
If the criteria is met(i.e., it evaluates to true), the tasks specified under the condition will be executed. If not, the tasks will be skipped.
Syntax
A criteria looks like the following snippet:
Each condition in the criteria can look like one of the following:
- (<expression1> <operator> <expression2>)
(or)
- (<function_returning_boolean>)
<expression1> | Expression whose value needs to be compared to a specified value. |
<function_returning_boolean> | Functions which return a boolean value. If the function returns True, the given tasks will be executed. Else, they will be skipped. |
<operator> | Operator to compare field/variable/expression value against the specified value. |
<expression2> | It may directly be a value, or an expression evaluating to the required value, which needs to be compared with the specified field/expression. |
Example
This is a sample criteria in the "if" conditional statement:
{
<actions_to_be_executed>
}
Applicable operators and expressions for TEXT expressions
The criteria format: <text_expression> <operator> <expression> must be used to specify the following operators.
Operator | Applicable expression |
---|---|
|
|
|
|
|
It is advisable to use isNull function instead to check null values |
|
|
Applicable operators and expressions for Number and Decimal expressions
The criteria format: <number/decimal_expression> <operator> <expression> must be used to specify the following operators.
Operator | Applicable expression |
---|---|
|
|
|
|
|
|
|
It is advisable to use isNull function instead to check null values |
|
|
Applicable operators and expressions for DATE-TIME expressions
The criteria format: <datetime_expression> <operator> <expression> must be used to specify the following operators.
Operator | Applicable expression |
---|---|
|
|
|
|
|
It is advisable to use this function instead to check null values |
|
|
Applicable operators and expressions for LIST expressions
The criteria format: <list_expression> <operator> <expression> must be used to specify the following operators.
Operator | Applicable expression |
---|---|
|
Even if the expression contains any additional elements apart from the specified values, that record will be treated as matching the criteria. |
|
|
Note: (Applicable only to Zoho Creator)
- You can also specify field link name in place of an expression. In such cases, the applicable operators will be based on the data-type of the specified field (as detailed above), except for the Name and Address main fields.
- For Name and Address main fields, the supported operators and expressions are mentioned below:
The criteria format: <field_link_name> <operator> (<expression>) must be used to specify the following operators.
Operator Applicable expression - ==
- !=
- is not
- null, or any expression that evaluates to null
It is advisable to use this function instead to check null values
The criteria format: <field_link_name>.<operator> (<expression>) must be used to specify the following operators.
Operator Applicable expression - contains
- TEXT value, or an expression that evaluates to a TEXT value
- isEmpty
NA
- Field link names cannot be specified when the conditional statement is written in Custom Functions or Custom Schedule Workflows.
- You can specify fields in the lookup form in the format<lookup_field_link_name>.<field_link_name>and the applicable operators will be based on the data-type of the specified field, as detailed above.
- You can specify fields in the Subform in the format<subform_field_link_name>.<field_link_name>and the applicable operators will be based on the data-type of the specified field, as detailed above.