Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
The filter is used to limit the set of records to be displayed in the list (in any list: related list, open list, the dictionary). The filter sets certain conditions for the record to meet to be in the list. Filters can be configured with the Condition Builder.
For example, we need to filter users living in Sevastopol. In SQL, we use the WHERE clause operator to filter records.
Tip |
---|
You can add a filter with all necessary filters in your Favorites in the Navigation menu. To do this, drag and drop the breadcrumbs to the Favorites navigation tab. |
Filter components
Filters consist of the following components:
- Condition builder (and the breadcrumbs as its integral part).
- Search and sorting:
- Input field at the top of every column is used for searching.
- Click on the column title to sort the search results.
- Filter Out/Show Matching (this item can be found in the context menu, to open it, right-click on the list cell).
All these components form the condition string, which is sent in the request as a GET parameter, and the filtered list of records will be returned and displayed.
The difference between condition builder on lists and regular condition builder is that breadcrumbs and sorting functionality added.
Breadcrumbs allow assessing the filter visually. Also, they allow quick filter editing by navigation to the condition specified.
Sorting allows adding its conditions (ascending or descending) on one or more list fields.
How
the filter worksfilters work
To be more visual, let's take an example.
We need to find Jonh find John Doe's closed requests, sorted by priority.
For this, we will create such a filter on the Request list (the itsm_request table):
After that, condition string can be found in the condition GET parameter:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
/list/itsm_request?condition=(stateIN7%4010%5Eassigned_user%3D159906491314467953)%5EORDERBYDESCpriority |
The condition string elements more closely:
Element | Description |
---|---|
stateIN7%4010 | State is one of Completed, Closed |
assigned_user%3D159906491314467953 | Assigned User is John Doe |
%5EORDERBYDESCpriority | Records will be sorted by the Priority field in the descending order |
Note | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Filtering for the fields of the Reference, List, Choice, Record Class and Field Name types has some nuances related to the value and default_value fields correlation in tables:
The table below can clarify the filtration specifics when doing the selection with field of types above involved.
See the Condition Operators article to obtain filter operators full list. |
Dynamic Filters
Dynamic filters extend the filters by the JS scripts executing ability. This ability is available in the list condition builder and in the dynamic reference qualifier condition builder.
In Condition Builder, dynamic filters are available when selecting the reference field and the 'is (dynamic)' or similar operator. After this, the list of available dynamic filters will appear.
When executing the filter as a value of the condition using the 'is dynamic' operator, the value returned by the dynamic filter script will be used.
To create a new dynamic filter, please complete the following steps (a new record in the Filter Option Dynamic (sys_filter_option_dynamic) table will be created):
- Navigate to System Definition → Dynamic Filters.
- Click New and fill in the fields.
- Click Save or Save and Exit to apply changes.
Info |
---|
You can also create dynamic filters for table fields of the sys_id type (ID). To do that, specify the dynamic filter form fields in the following way:
To apply the dynamic filter created, specify the ID table column and the is (dynamic) operator as the Condition Builder field and operator appropriately. |
Dynamic filters form fields
Field | Mandatory | Description |
---|---|---|
Title | Y | The filter title. |
Column Type | N | The column type used in this filter. This field references to the Columns dictionary. |
Referenced Table | Y | Choose the table to apply this filter on. |
Available for Filter | N | Select this checkbox to make this filter available in the filters list filters. |
Available for Reference Qualifier | N | Select this checkbox to make this filter available for a dynamic reference qualifier. |
Active | N | Select this checkbox to make the filter active. |
Order | N | Enter the number to define the order of filter processing. |
Script | Y | Enter the script that the dynamic filter runs. You can use all methods of server-side API classes here. After executing, the script should return the record ID or array of IDs. |
Table of Contents | ||||
---|---|---|---|---|
|