Data Source Filters
You can use Filters to limit the volume of results returned by a data source query. This lets you dynamically control the number of rows in a grid, the responses to a data-driven multiple choice question, and more.
Each filter is associated with a single data source. A data source can have more than one filter, but only one filter can be applied per multiple choice question, grid, or other instance where the data source is used by an application.
A filter consists of one or more Conditions, each of which applies a limitation to the data returned. Filtered data sources will only return rows that satisfy all conditions of the filter.
For example, consider the following data, representing a table called ToyCatalogue that is targeted by a data source:
ProductID | Description | Price | ReleaseDate |
---|---|---|---|
JA1242498 | Red toy car (metal) | £5.99 | 03/12/2017 |
JA1242501 | Wooden horse | £14.99 | 14/04/2017 |
JA1242502 | Water pistol | £7.99 | 18/02/2018 |
JA1242504 | Stuffed toy zebra | £8.99 | 22/12/2017 |
JA1242507 | Rainbow streamers | £1.99 | 28/08/2017 |
JA1242508 | Child's doctor costume | £18.99 | 19/05/2017 |
If a filter were applied to the data source, and its single condition states that Price cannot be greater than £10.00, the results would be:
ProductID | Description | Price | ReleaseDate |
---|---|---|---|
JA1242498 | Red toy car (metal) | £5.99 | 03/12/2017 |
JA1242502 | Water pistol | £7.99 | 18/02/2018 |
JA1242504 | Stuffed toy zebra | £8.99 | 22/12/2017 |
JA1242507 | Rainbow streamers | £1.99 | 28/08/2017 |
Following this, a second condition is added to the filter. This condition states that only products that have been released should be shown. When viewing the filtered data source on 19th December 2017, the results returned would be as follows:
ProductID | Description | Price | ReleaseDate |
---|---|---|---|
JA1242498 | Red toy car (metal) | £5.99 | 03/12/2017 |
JA1242507 | Rainbow streamers | £1.99 | 28/08/2017 |
With the two conditions described above, the filter needed to return these results would contain two conditions, and be written as follows:
Price Is less than or equal to "10" And
ReleaseDate Is less than or equal to [GetDate()]
When you add conditions to a filter, the syntax is generated automatically. For more information about adding and modifying filters, refer to the Managing Data Source Filters.