Building complex pre-filters and post-filters in the Factory
When working in the Data Manager task, complex pre-filters or post-filters allow you to combine multiple filter statements with AND/OR conditions via the Indent selection feature.
For example, you can create two different filter groups that have to comply with different conditions.
The innermost filter conditions (closest to the attributes) have the highest priority, so filtering conditions need to be read outwards.
You can switch between AND/OR by clicking on the indent bar.
The Indent selection can be interpreted as putting brackets around an operation in algebraic expressions, defining its priority over the others.
Prerequisites
You must have created a flow;
You must have set pre-filter or post-filter conditions in the Data Manager task.
Procedure
In the pre-filter or post-filter area, select the attributes you want to place in the same condition.
Right-click the attributes, or click on the three-dotted button to open the context menu.
Select Indent selection: the AND filtering operator is applied by default to the selected attributes: to switch to OR click on the AND filtering condition.
Click Make persistent to effectively apply this filtering operation to the dataset.
Save and compute the task.
To delete the indent operation performed, you can click the Unindent selection button.
Example
The following example uses the Adult dataset.
After having set the filters for each attribute, we can start using the Indent selection option.
In the following example, we want to filter the dataset to include two targeted groups that have been identified for a campaign:
men younger than 28;
women over 28.
All selected rows must belong to one of the two sets of conditions.
Step | Screenshot |
---|---|
Filter age and sex for men younger than 28, or sex and age of women older than 28: this means that the software will filter the sex and age attributes twice, then both filter condition groups will be displayed, as the outer condition is or:
| |
| |
| |
| |
|