Overview
A criteria is required when you need to fetch a collection of records. 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), all the records which meet the criteria will be fetched.
Syntax
A criteria looks like the following snippet:
Each condition comprises of the following:
<field_link_name> | Link name of the field whose value needs to be compared to a specified value. Only link names of fields and its related fields must be specified. |
<operator> | Operator to compare field value against the specified value. |
<expression> | The value to be compared with the field value. It may directly be a value, or an expression evaluating to the required value. |
For example:
// 'email' and 'phone' are the form fields
// in the example, we have 2 conditions separated by the && logical operator
// each condition has a field, an operator, and the expression to be compared
// such conditions can be used to fetch records which meet the criteria
Applicable operators and expressions for Name and Address field types.
The criteria format: <field_link_name> <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 |
The criteria format: <field_link_name>.<operator> (<expression>) must be used to specify the following operators.
Operator | Applicable expression |
|
|
| NA |
Applicable operators and expressions for Name(subfields), Email, Address(subfields), Single Line, Multi Line, Drop down, Radio, Formula (String), Rich Text, Phone Number, URL, Image, File Upload, Audio, Video, Signature, Users, Added User, Modified User, and Integration field types
The criteria format: <field_link_name> <operator> <expression> must be used to specify the following operators.
Operator | Applicable expression |
---|---|
|
|
|
|
The criteria format: <field_link_name>.<operator> (<expression>) must be used to specify the following operators.
Operator | Applicable expression |
---|---|
|
|
| NA |
Note:
- The subfields for Name field type must be specified in the format:
- <field_link_name>.prefix
- <field_link_name>.first_name
- <field_link_name>.last_name
- <field_link_name>.suffix
- The subfields for Address field type must be specified in the format:
- <field_link_name>.address_line_1
- <field_link_name>.address_line_2
- <field_link_name>.district_city
- <field_link_name>.state_province
- <field_link_name>.postal_code
- <field_link_name>.country
- <field_link_name>.longitude
- <field_link_name>.latitude
- If more than one Name fields are present in the form, the link names of the subsequent sub fields will be appended by a number starting from 1. So, if we take the example of the subfield <field>.prefix, the link name of the first such field will be <field>.prefix, the link name of the second such field will be <field>.prefix1, the link name of the third such field will be <field>.prefix2, and so on.
- Similarly, if more than one Address fields are present in the form, the link names of the subsequent sub fields will be appended by a number starting from 1. So, if we take the example of the subfield <field>.country, the link name of the first such field will be <field>.country, the link name of the second such field will be <field>.country1, the link name of the third such field will be <field>.country2, and so on.
- For Rich Text field type, the string value must be provided with the applicable html tags, if any.
- For Phone Number field type, the string value must be provided along with the country code.
- For URL with title, linkname and target as "new window". If these properties are not enabled, they can be removed from the url format.
- "<a href= \"<URL>\" title = \"<TITLE>\" target = \"_blank\"><linkname></a>"
- For Image with linkname, title, and target as "new window". If these properties are not enabled, they can be removed from the url format.
- "<a href= \"http://<LINKNAME>\" title =\"<TITLE>\" target = \"_blank\"><img src = \"<URL>\" title =\"<TITLE>\"></img></a>"
- For File upload field type, the string value must be in the format:
- <file-id>_<file-name>.<file-type>
// The file-id is a unique id assigned to each file. Execute the info statement to view the exact format of the value as stored in the database.
- For Audio and Video field types, The string value must be in the format:
- <file-id>_<file-size-in-bytes>_<file-name>.<file-type>
// The file-id is a unique id assigned to each file. Execute the info statement to view the exact format of the value as stored in the database.
- For Signature field type, The string value must be in the format:
- <file-id>_<field-link-name>.png
// The file-id is a unique id assigned to each file. Execute the info statement to view the exact format of the value as stored in the database.
- For Users, Added user and Modified user, you can check the list of users and their email addresses from the Users section in your application. To check with the email address of the users, specify <field_link_name> in the following format:
- <field_link_name>.email // will work only for the Users field type and for the operators: ==, !=, is, and is not.
- For Integration field type, you need to specify the record id.
Applicable operators and expressions for Number, Autonumber, Percent, Currency, Decimal, ID and Formula(bigint/decimal) field types
The criteria format: <field_link_name> <operator> <expression> must be used to specify the following operators.
Operator | Applicable expression |
---|---|
|
|
|
|
|
|
The criteria format: <field_link_name>.<operator> (<expression>) must be used to specify the following operators.
Operator | Applicable expression |
---|---|
|
|
Applicable operators and expressions for Date, Date-time, Added Time and Modified Time field types
The criteria format: <field_link_name> <operator> <expression> must be used to specify the following operators.
Operator | Applicable expression |
---|---|
|
|
|
|
|
<n> stands for any valid natural number. |
Applicable operators and expressions for decision box field type
The criteria format: <field_link_name> <operator> <expression> must be used to specify the following operators.
Operator | Applicable expression |
---|---|
|
|
The decision box field type can also be specified in the following format: <collection_variable> = <Form>[<decision_box>]; // implies the decision box value is true<collection_variable> = <Form>[!<decision_box>]; // implies the decision box value is false |
Applicable operators and expressions for multi select and checkbox field types
The criteria format: <field_link_name> <operator> <expression> must be used to specify the following operators.
Operator | Applicable expression |
---|---|
|
Even if the field contains any additional choices apart from the choices specified in the expression, that record will be treated as matching the criteria. |
|
If the field contains any additional choices apart from the choices specified in the expression, that record will be treated as matching the criteria. |
The criteria format: <field_link_name>.<operator> (<expression>) must be used to specify the following operators.
Operator | Applicable expression |
---|---|
|
The specified string value will not be treated as a choice, instead it will treated as string characters and all the choices containing the string characters will be treated as matching the criteria. |
| NA |
Applicable operators and expressions for Lookup - Multiselect and Checkbox field types
The criteria format: <field_link_name> <operator> <expression> must be used to specify the following operators.
Operator | Applicable expression |
---|---|
|
You need to specify the record id. |
The criteria format: <field_link_name>.<operator> (<expression>) must be used to specify the following operators.
Operator | Applicable expression |
---|---|
|
The specified value will not be treated as a choice, instead it will treated as string characters and all the choices containing the characters will be treated as matching the criteria. You need to specify record IDs as values. |
| NA |
Applicable operators and expressions for Lookup - Drop-down and Radio field types
The criteria format: <field_link_name> <operator> <expression> must be used to specify the following operators.
Operator | Applicable expression |
---|---|
|
You need to specify record IDs as values. |
|
You need to specify record IDs as values. |
The criteria format: <field_link_name>.<operator> (<expression>) must be used to specify the following operators.
Operator | Applicable expression |
---|---|
|
You need to specify record IDs as values. |
| NA |
Note:
- Lookup subfields and Subform fields
- You can specify fields in the lookup form in the format<lookup_field_link_name>.<field_link_name>and the operators and expressions must be specified based on the field type of the <field_link_name>, as mentioned in the above tables
- You can specify fields in the Subform in the format<subform_field_link_name>.<field_link_name>and the operators and expressions must be specified based on the field type of the <field_link_name>, as mentioned in the above tables
- You can specify fields in the lookup form in the format
- Encrypted fields
- The following are the only applicable operators and built-in functions for fields whose data encryption is enabled: ==, !=, and isEmpty().