Criteria to fetch records

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:

(<condition_1> <logical_operator_1> <condition_2> <logical_operator_2> ..... <condition_n>)

Each condition comprises of the following:

(<field_link_name> <operator> <expression>)

<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.

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.

OperatorApplicable expression
  • ==
  • !=
  • is not
  • 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.

OperatorApplicable expression
  • contains
  • string value, or an expression that evaluates to a string value
  • isEmpty

       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.

OperatorApplicable expression
  • ==
  • !=
  • is
  • is not
  • string value, or an expression that evaluates to a string value
  • string list
  • in
  • not in
  • string list

The criteria format: <field_link_name>.<operator> (<expression>) must be used to specify the following operators.

OperatorApplicable expression
  • contains
  • startsWith
  • endsWith
  • equalsIgnoreCase
  • string value, or an expression that evaluates to a string value
  • isEmpty
          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_id // 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.

OperatorApplicable expression
  • ==
  • !=
  • is
  • is not
  • bigint/decimal value, or an expression that evaluates to a bigint/decimal value
  • bigint/decimal list (or list with numerical values in quotes)
  • in
  • not in
  • bigint/decimal list (or list with numbers in quotes)
  • >
  • >= 
  • <= 
  • bigint/decimal value or an expression that evaluates to a bigint/decimal value

The criteria format: <field_link_name>.<operator> (<expression>) must be used to specify the following operators.

OperatorApplicable expression
  • contains
  • startsWith
  • endsWith
  • bigint/decimal value within double quotes.

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.

OperatorApplicable expression
  • ==
  • !=
  • is 
  • is not
  • tomorrow
  • yesterday
  • now
  • today
  • date system variables
  • any date/date-time value or an expression that evaluates to a date/date-time value
  • list of date-time values
  • not in
  • list of date-time values
  • in
  • any date/date-time value or an expression that evaluates to a date/date-time value
  • list of date-time values
  • next week
  • next month
  • next year
  • last week
  • last month
  • last year
  • next <n> weeks
  • next <n> months
  • next <n> years
  • last <n> weeks
  • last <n> months
  • last <n> years
  • <n> weeks ago
  • <n> months ago
  • <n> years ago
  • this week
  • this month
  • this year

 <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.

OperatorApplicable expression
  • ==
  • !=
  • is 
  • is not
  • true
  • false

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.

OperatorApplicable expression
  • ==
  • in
  • a list or an expression which evaluates to a list 

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.

  • !=
  • not in
  • a list or an expression which evaluates to a list 

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.

OperatorApplicable expression
  • contains
  • startsWith
  • endsWith
  • equalsIgnoreCase
  • string value, or an expression that evaluates to a string value

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.

  • isEmpty
          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.

OperatorApplicable expression
  • ==
  • !=   
  • in
  • not in
  • bigint list, or an expression that evaluates to a bigint list 

You need to specify the record id.

The criteria format: <field_link_name>.<operator> (<expression>) must be used to specify the following operators.

OperatorApplicable expression
  • contains
  • startsWith
  • endsWith
  • equalsIgnoreCase
  • bigint value within double quotes

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.

  • isEmpty
          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.

OperatorApplicable expression
  • == 
  • !=
  • is
  • is not
  • bigint value, or an expression that evaluates to a bigint value
  • bigint list

You need to specify record IDs as values.

  • in
  • not in
  • bigint list

You need to specify record IDs as values.

The criteria format: <field_link_name>.<operator> (<expression>) must be used to specify the following operators.

OperatorApplicable expression
  • contains
  • startsWith
  • endsWith
  • equalsIgnoreCase
  • string value, or an expression that evaluates to a string value

You need to specify record IDs as values.

  • isEmpty
          NA

Note: Lookupsubfields 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

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: support@zohodeluge.com