Add Criteria
Last updated 6/04/2022
Add a Query Field with a Criteria Condition
The Criteria field is used to filter records. It is used to extract only those records that meet a specified condition. These criteria conditions can be connected through AND and OR conditions. The Criteria field must be used with a selected field.
Select Menus in the menu.
Click the Add Item button in the list app bar.
Type a title in the Title field.
Click in the Query field to open the Table and Fields Designer.
![Add a query](/2.5/img/queries/table-fields-designer/create-query/appointment-details-query.png)
- Click the Add Table button.
![Add a Table](/2.5/img/queries/table-fields-designer/add-criteria/add-table.png)
- Select a table.
![Select Table Name](/2.5/img/queries/table-fields-designer/add-criteria/select-table.png)
Double click the field names required for the query.
Type a condition in the Criteria field.
![Add Fields and Criteria](/2.5/img/queries/table-fields-designer/add-criteria/add-criteria.png)
> 1000
This WHERE
statement will return all patients with a patient number greater than 1000. Because the first name and last name fields are included in the query, these are also included in the result set.
![Result Set](/2.5/img/queries/table-fields-designer/add-criteria/patient-number-results.png)
When entering a string it is strongly recommended to use quotes ''
around the value to clearly define that it is a string.
- Click the Save button in the Table and Fields Designer app bar.
![Save the query](/2.5/img/queries/table-fields-designer/and-condition/save-query.png)
- Click the Fields tab.
![Fields Tab](/2.5/img/queries/table-fields-designer/and-condition/fields-tab.png)
- Click the Save button in the form app bar.
![Save the form](/2.5/img/queries/table-fields-designer/add-criteria/save-form.png)
When using critieria for more than one field in the row, Five will create an AND condition. The records will be returned when all the criterias are met.
When using more than one criteria in multiple columns, Five will create an OR condition. The records will be returned when any one of the criterias are met.
Operators in the Criteria
The following operators can be used in the Criteria field.
Operator | Description | |
---|---|---|
= | Equals | SQL example |
> | Greater than | SQL example |
< | Less than | SQL example |
>= | Greater than or equal | SQL example |
<= | Less than or equal | SQL example |
<> | Not equal | SQL example |
BETWEEN | Between a certain range | SQL example |
LIKE | Search for a pattern | SQL example |
IN | To specify multiple possible values for a column | SQL example |
NOT IN | To specify values are not in a list of values | SQL example |
In Five, you do not need to write the full SQL syntax in the Criteria field.
Examples of How to Write Conditions in the Criteria Field
Operator | Example |
---|---|
= | = 'Brisbane' |
> | > 4000 |
< | < 4000 |
>= | >= 4777 |
<= | <= 4777 |
<> | <> 4777 |
BETWEEN | To be implemented |
LIKE | To be implemented |
IN | To be implemented |
NOT IN | To be implemented |