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: for example, in the related list, open list, or the dictionarytable). The filter sets certain conditions for the record to meet to be in the list. Filters Filters can be configured with the Condition Buildercondition builder.
For example, we you need to filter users living in SevastopolMoscow. In In SQL, we use the WHERE operator to filter records.
Tip |
---|
You can add a filter with all necessary filters conditions in your Favorites in the Navigation navigation menu. To do thisso, drag and drop the breadcrumbs to breadcrumbs to the Favorites navigation tab.
|
Filter
componentsinstruments
Filters consist of the following componentsinstruments:
- 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 that is sent in the request as a GET parameter, and the . The filtered list of records will be is returned and displayed.
Image Removed
Image Added
The difference between the condition builder on lists and the regular condition builder is that breadcrumbs and sorting functionality are added.
Breadcrumbs allow assessing The breadcrumbs allow you to assess the filter visually. Also, they allow you can edit quick filter editing by navigation to the condition specified.
Sorting allows adding The sorting allows you to add its conditions (ascending or descending) on one or more list fields.
How filters work
For more clarity, let's take an example.We need to find John example, you need to find John Doe's closed requestsregistered requests with the Low or Moderate priority, sorted by priority.
For this, we will create such a filter on the Request list (the To do so, create the following filter for the Request (itsm_request table) table:
Image Removed
Image Added
After that, the condition string can be found in the condition GET parameter: . The browser adds %3D, %5E, %E to encode special symbols.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
/list/task?condition=(state%3D-2%5EdescriptionISEMPTY%5Epriority<32%5Epriority<3%5Eassigned_user%3D160114171110151) |
The condition string elements more closely:
%5EORDERBYDESCpriority |
Element | Description |
---|---|
state%3D-2 | State is Registered |
priority<3 |
The set of records with Priority value less |
than 3 will be displayed (Moderate and Low) |
assigned_user%3D160114171110151 | The record ID of the user. |
ORDERBYDESCpriority | The records |
will be sorted by the Priority field in descending order |
Encoding and decoding queries
To decode an encoded query string storing the condition obtained from the GET parameter, we recommend using the addEncodedQuery and getConditionQuery methods of the SimpleRecord Server-Side class. You can decode the encoded string by completing the simple steps:
- Perform a selection against the table list view using a Condition Builder.
- Copy the condition from the URL as shown on the screenshot below:
Image Removed
- Navigate to System Definition → System Scripts and click New.
Fill in the Script field with code below (this one is given for example):
Fill in the {tableName} placeholder with the table system name.
- Fill in the {conditionQueryCondition} placeholder with the copied condition.
- Click Run to execute the script.
language | js |
---|---|
theme | Eclipse |
title | Decode encoded query |
linenumbers | true |
. |
Note | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Filtering The filtering for the fields of the Reference, List, Choice, Record Class and Field Name types has some nuances specifics. It is related to the value and display_value fields correlation in tables:
The table below can clarify the filtration specifics when doing the selection with field of types above involvedexplains the features of filtering when selecting the fields of the above types.
See the Condition Operators article article to obtain the full list of filter operators full list. |
Dynamic
Filtersfilters
Dynamic filters extend the filters by the JS executing JavaScript scripts executing ability. This ability is available in the list condition builder and in the dynamic the dynamic reference qualifier condition builder.
In Condition Builderthe 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 Dynamic filter scripts return a value that will be used in place of the condition using the 'is dynamic ' operator, the value returned by the dynamic filter script will be usedfilter when filtering.
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 → Settings → Dynamic FiltersFilter Options.
- Click New and fill in the fields.
- Click Save or Save and Exitexit to apply the changes.
As a result, a new record will be created in the Dynamic Filter Options (sys_filter_option_dynamic)table.
Info |
---|
You can also create dynamic filters for table fields of the sys_id type (ID)ID fields. To do thatso, 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 appropriatelyin the condition builder. |
Dynamic filters Filter form fields
Field | Mandatory | Description | ||
---|---|---|---|---|
Title | Y+ | The Specify the filter title. | ||
Column Typetype | N- | The Specify the column type used in this filter. This field references to the Columns dictionary. noteThe Reference Qualifier tab is available only for field of Reference or List types. For fields of other types, use Condition Builder Options. | ||
Referenced table | + | Referenced Table | Y | Choose the table to apply this filter on. |
Available for Filterfilter | N- | Select this checkbox to make this filter available in the filters list. | ||
Available for Reference Qualifierreference 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 set the list output 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 | ||||
---|---|---|---|---|
|