Form Editor - Filtering
The data shown in the form can be filtered in two different ways:
- Using the filtering controls
- Applying custom filter condition
The simplest way to filter data by one or multiple columns is to use the database controls in the filter mode.
The following controls can be switched to the filter mode:
All of them are bound to the specific fields, therefore, the filter is applied to these fields.
They have the following data modes for filtering:
- Filter - The value for filtering can be assigned but the filter is not applied to the field automatically and requires calling applyFilters method of the cursor.
- Filter And Apply - The filter is automatically applied to the field after the user input.
The control in the filter mode is marked with the magnifying glass icon:
Once the filter is applied all values for filter are combined using the AND operation to generate a query like the following:
SELECT f1, f2, f3 WHERE LOWER( "f1" ) LIKE '%filter_value1%' AND LOWER( "f2" ) LIKE '%filter_value2%';
In order to define more complex filtering conditions, the custom filter should be applied.
Filtering condition is passed to the addFilter method of the cursor, for example:
records = this.table.getTableCursor( this.name ); records.addFilter( 'f1 > 10' );
To apply this filter to the cursor applyFilters method must be called:
The filter string becomes the part of the WHERE clause, like:
SELECT f1, f2 FROM t1 WHERE f1 > 10;
In order to remove the filtering or to apply a new filter, clearFilters method must be called: