A condition builder constructs a condition statement with a series of contextually generated fields. Condition builders are used in many operations, such as creating filters, administering surveys, and administering access control.
2 Condition Builder Format
A condition consists of three parts:
- Field: a choice list based on the table and user access rights. The choice list includes fields on related tables by dot-walking.
- Operator: a choice list based on the field type. For example, in the Incident table, the greater than operator does not apply to the Active field but it does apply to the Priority field. For a full list, see operators.
- Value: a text entry field or a choice list, depending on field type. For example, in the Incident table, the Active field offers a choice list with the values true, false, and empty, while the Short Description field offers a text entry field.
3 Building Conditions
To add a top-level condition, click Add AND condition or Add OR condition on the condition builder toolbar, above the conditions.
3.1 Filtering on Empty Fields
Most filter operations do not return empty fields in their result set. You can create a filter that displays records with an empty field value in addition to records that match the initial filter conditions. For example, when viewing all records that are assigned to the Hardware group, to include records with an empty Assignment group field:
- Create the filter condition Assignment group is Hardware.
- This condition does not return those records where the Assignment group field is empty.
- Click OR next to the original filter condition.
- Create an additional filter condition of Assignment group is empty.
- Run the filter.
Several logical operators are available for each field type when creating a condition. See Operators Available for Filters and Queries.
|Note: The operators ‘less than or is’ and ‘greater than or is’ are not supported for integer fields in the condition builder. Use a scripted condition instead.|
5 Values for Date/Time Fields
When you filter on fields of type Date/Time, such as the Created field on any task record, several time-related options are available like Today, This week, Last 3 months, and so on.
For example, at 12 P.M. on June 1st, a user in New York filters a list of incidents using the Created on Today condition. The resulting list shows all incidents created during the last six hours: between midnight (00:00:00) and the user's current time, noon (12:00:00), on June 1st. A filter for This week returns incidents created between the previous Monday at midnight to the current day and time.
A filter for Last 3 months returns incidents between midnight on the 1st of the month three full months ago and the current day and time. For example, if you choose the Last 3 months filter on April 15th, the results show records created since January 1st up until April 15. A filter for Last 12 months returns records created from midnight on the first of the month twelve months ago and the current day and time.
For the at or before and at or after filters, use midnight as a start or end point. For example, if you filter a list of incidents created at or after Yesterday, the resulting list shows all incidents created at midnight yesterday or later. If it is Thursday August 7 and you filter a list of incidents created at or before Last week, the resulting list shows all incidents created at and before midnight on Sunday August 3, which is the end of last week.
- The glide.list.filter_max_length property allows administrators to set a maximum character limit for a condition builder query.