filter Data Group Type
The filter data group type is one of the collection of data manipulation types: filter, group, merged, pivot and relative.
A filter data group takes the rows from another data group (its “base”) and filters them according rules that you set (note: you cannot base a data group on a data manipulation data group).
This is particularly useful if, for example:
- you have a base data group whose content you cannot control (such as a CSV or an API/plugin based data group)
- you have one large set of data in one data group that you want to use for different purposes in a single DSD (this saves loading the data each time for each purpose).
The are two options for filtering the rows in the base data group: Filter and Test
This uses an xPath query on the base data group’s data container to select the qualifying rows for the filter data group. For example:
This requests every row in the data container element (the ‘*’ denotes this) that contains an element called “Type” whose value is “A”.
The query is executed directly on the base data and so is much more efficient than the Test option, which has to be executed row by row after the xPath query (if specified) has been applied.
However, if you do not know xPath or do not know the structure of the base data group’s container do not attempt this method.
If filtering cannot be done by xPath or you are unsure of the xPath query language, use an fSeries function to determine whether each row is to be included in the data group. The test is executed on each row after the “Filter” xPath query has been executed.
Any fSeries function (or combination) may be used but it must result in “true” for the row to be included. For example. the equivalent of the above xPath query would be:
A filter data group is executed with the DSD in it’s position in the sequence of data groups. However, you may need to have it executed when another data group’s current row is changed. For example if the filter applied is based on, say, the value of the “Type” field in a other data group (other than its base).
You can specify that the filter should be re-applied on the change of any data group’s current row by checking it in the list provided. Do not select the filter data group’s base as this will be ignored.