Understanding the Dynamic Filtering Process
Dynamic filters are defined in tables. Several tables can be defined and they can share columns. Depending on the model, the dynamic filter can be built at runtime with several tables. In this case, the domain definition is defined based on the combination of these tables.
At runtime, this domain can be filtered and some values can appear "forbidden."
Defining the Domain Available at Runtime and Compatibility Between Values
As an administrator, I want to define which values can be picked by an end user and compatibility between the different values. Domains and compatibility between values can be defined in tables and tables can be combined in order to define the expected behavior.
The combination of several tables to build a dynamic filter is executed following these steps:
- Initial domain creation - union of all domains.
- Domain normalization - when intervals are defined, the domain can be "simplified" (this step depends on the type of the columns).
- Domain filtering - values that will never be possible are removed from the domain.
After these steps, the domain is created and available at runtime.
EXAMPLES
Example 1
The following tables are defined in the dynamic filter service:
Table 1
| TYPE (STRING) | HORSEPOWER (INTEGER) | ||
|---|---|---|---|
| = | Sedan | = | 100 |
| = | Sedan | = | 200 |
| = | Sedan | = | 500 |
| = | Compact | = | 300 |
Table 2
| TYPE (STRING) | HORSEPOWER (INTEGER) | ||
|---|---|---|---|
| = | Red | = | 100 |
| = | Red | = | 200 |
| = | Green | = | 400 |
If one table is attached to a line template:
In the Quote model, the Table1 is attached to a Line Template. The following domain is available at runtime:
- Type: Sedan, Compact
- HorsePower: 100, 200, 300, 500
If both tables are attached to a line template:
In the Quote model, Table1 and Table 2 are attached to a Line Template. The available domain at runtime is computed as following:
Step 1: The domain is the union of the tables.
- Type: Sedan, Compact
- HorsePower: 100, 200, 300, 400, 500
- Color: Red, Green
Step 2: No interval. Nothing to do.
Step 3: The domain is filtered to remove "out of domain" values.
- Type: Sedan, Compact
- HorsePower: 100, 200, 300, 400, 500
- Color: Red, Green
At runtime, the following domain will be available:
- Type: Sedan
- HorsePower: 100, 200
- Color: Red
Out of Domain Values
In the previous example, Compact is considered as an "out of domain" value:
- Compact is compatible with 300 (HorsePower) - Table 1
- 300 is not defined in the Table2
That means Compact will be never a valid value. Green is also considered as an "out domain" value:
- Green is compatible with 400 (HorsePower) - Table 2
- 400 is not defined in the Table1
That means Green will be never a valid value.
Example 2 (leveraging the null value)
The following tables are defined in the dynamic filter service:
Table 1
| TYPE (STRING) | HORSEPOWER (INTEGER) | ||
|---|---|---|---|
| = | Sedan | = | 100 |
| = | Sedan | = | 200 |
| = | Sedan | = | 500 |
| TYPE (STRING) | HORSEPOWER (INTEGER) | ||
|---|---|---|---|
| = | Compact | = | 300 |
| = | Sport | = | null |
Table 2
| TYPE (STRING) | HORSEPOWER (INTEGER) | ||
|---|---|---|---|
| = | Red | = | 100 |
| = | Red | = | 200 |
| = | Green | = | 400 |
If one table is attached to a line template:
In the Quote model, the Table 1 is attached to a Line Template. The following domain is available:
- Type: Sedan, Compact, Sport
- HorsePower: 100, 200, 300, 500
If two tables are attached to a line template:
In the Quote model, Table 1 and Table 2 are attached to a Line Template. The available domain at runtime is computed as following:
Step 1: The domain is the union of the tables
- Type: Sedan, Compact, Sport
- HorsePower: 100, 200, 300, 400, 500
- Color: Red, Green
Step 2: No interval. Nothing to do.
Step 3: The domain is filtered to remove "out of domain" values.
- Type: Sedan, Compact, Sport
- HorsePower: 100, 200, 300, 400, 500
- Color: Red, Green
At runtime, the following domain will be available:
- Type: Sedan, Sport
- HorsePower: 100, 200, 400
- Color: Red, Green
Out of Domain Values
In this example, Compact is considered as an "out of domain" value:
- Compact is compatible with 300 (HorsePower) - Table1
- 300 is not defined in the Table2
That means Compact will be never a valid value.
Nevertheless, Green is now available as Sport is compatible with all listed values (100, 200, 300, 400 and 500).
Example 3 (restricting the domain of a column)
The following tables are defined in the dynamic filter service:
Table 1
| TYPE (STRING) | HORSEPOWER (INTEGER) | ||
|---|---|---|---|
| = | Sedan | = | 100 |
| = | Sedan | = | 200 |
| = | Sedan | = | 500 |
| = | Compact | = | 300 |
| = | Sport | = | null |
Table 2
| TYPE (STRING) | HORSEPOWER (INTEGER) | ||
|---|---|---|---|
| = | Red | = | 100 |
| = | Red | = | 200 |
| = | Green | = | 400 |
Table 3
| HORSEPOWER (INTEGER) | |
|---|---|
| = | 100 |
| = | 200 |
On a line template LT2, Table 1, Table 2, and Table 3 are attached.
Step 1: The domain is the union of the tables.
- Type: Sedan, Compact, Sport
- HorsePower: 100, 200, 300, 400, 500
- Color: Red, Green
Step 2: No interval. Nothing to do.
Step 3: The domain is filtered to remove "out of domain" values.
- Type: Sedan, Compact, Sport
- HorsePower: 100, 200, 300, 400, 500
- Color: Red, Green
At runtime, the following domain will be available:
- Type: Sedan, Sport
- HorsePower: 100, 200
- Color: Red
Out of Domain Values
In this example, Compact is considered as an "out of domain" value:
- Compact is compatible with 300 (HorsePower) - Table 1
- 300 is not defined in the Table 2
That means Compact will be never a valid value.
400 is not defined in the Table 3 so this value will be never a valid value. As a consequence, Green is also out of domain.
Example 4 (using intervals)
The following tables are defined in the dynamic filter service:
Table 1
| TYPE (STRING) | HORSEPOWER (INTEGER) | ||
|---|---|---|---|
| = | Sedan | = | 100 |
| = | Sedan | = | 200 |
| = | Sedan | = | 500 |
| = | Compact | = | 300 |
| = | Compact | > | 350 |
Table 2
| TYPE (STRING) | HORSEPOWER (INTEGER) | ||
|---|---|---|---|
| = | Red | = | 100 |
| = | Red | = | 200 |
| = | Green | > | 400 |
If one table is attached to a line template:
- Type: Sedan, Compact
- HorsePower: 100, 200, 300, >350
If both tables are attached to a line template:
In the Quote model, Table 1 and Table 2 are attached to a Line Template. The available domain at runtime is computed as following:
Step 1: The domain is the union of the tables.
- Type: Sedan, Compact
- HorsePower: 100, 200, 300, 500, >350, >400
- Color: Red, Green
Step 2: The domain is simplified according to the intervals.
- Type: Sedan, Compact
- HorsePower: 100, 200, 300, 500, >350, >400
- Color: Red, Green
Step 3: The domain is filtered to remove "out of domain" values.
- Type: Sedan, Compact
- HorsePower: 100, 200, 300, 500, >350, >400
- Color: Red, Green
At runtime, the following domain will be available:
- Type: Sedan, Compact
- HorsePower: 100, 200, >400
- Color: Red, Green
Out of Domain Values
In this example, 300 is considered as an "out of domain" value:
- 300 is not defined in Table 2
That means 300 will be never a valid value.
After the "compactage", >350 was kept as it includes >400 and 500. Nevertheless, when the domain is filtered, as values between 350 and 400 are not listed in the Table2, they are out of domain. This is why only >400 will be available in the domain.
The interval >400 removes 500 from the "proposed" domain as 500 is included in >400.
Example 5 (using intervals and null value)
The following tables are defined in the dynamic filter service:
Table 1
| TYPE (STRING) | HORSEPOWER (INTEGER) | ||
|---|---|---|---|
| = | Sedan | = | 100 |
| = | Sedan | = | 200 |
| = | Sedan | = | 500 |
| = | Compact | = | 300 |
| = | Compact | > | 350 |
| = | Sport | = | null |
Table 2
| TYPE (STRING) | HORSEPOWER (INTEGER) | ||
|---|---|---|---|
| = | Red | = | 100 |
| = | Red | = | 200 |
| = | Green | > | 400 |
In the Quote model, on a line template, Table 1 and Table 2 are attached.
Step 1: The domain is the union of the tables.
- Type: Sedan, Compact, Sport
- HorsePower: 100, 200, 300, 500, >350, >400
- Color: Red, Green
Step 2: The domain is simplified according to the intervals.
- Type: Sedan, Compact, Sport
- HorsePower: 100, 200, 300, 500, >350, >400
- Color: Red, Green
Step 3: The domain is filtered to remove "out of domain" values.
- Type: Sedan, Compact, Sport
- HorsePower: 100, 200, 300, 500, >350, >400
- Color: Red, Green
At runtime, the following domain will be available:
- Type: Sedan, Compact, Sport
- HorsePower: 100, 200, >400
- Color: Red, GreenNull Value:
Sport is compatible with 100, 200 and values >400. The null value matches all domain values (the domain available after the 3 steps).
Example 6 (using STRING type and LIKE operator)
The following tables are defined in the dynamic filter service:
Table 1
| TYPE (STRING) | HORSEPOWER (INTEGER) | ||
|---|---|---|---|
| = | Sedan | LIKE | 100 |
| TYPE (STRING) | HORSEPOWER (INTEGER) | ||
|---|---|---|---|
| = | Sedan | = | 200 |
| = | Sedan | = | 500 |
| = | Compact | = | 300 |
| = | Compact | = | 350 |
| = | Sport | = | null |
Table 2
| TYPE (STRING) | HORSEPOWER (INTEGER) | ||
|---|---|---|---|
| = | Red | = | 100 |
| = | Red | = | 200 |
| = | Green | LIKE | 400 |
In the Quote model, on a line template, Table 1 and Table 2 are attached.
Step 1: The domain is the union of the tables.
- Type: Sedan, Compact, Sport
- HorsePower: 100, 200, 300, 350, 500
- Color: Red, Green
LIKE Operator
The LIKE operator is not used to build the initial domain. This operator is leveraged only during filtering. This is why 400 is not part of the domain (100 is defined with the = operator in the Table2). In addition, only values that are part of the initial domain will be considered as valid. The filtering (executed once the initial domain is built) always reduces the initial domain. The LIKE operator can't be used to define a domain.
Step 2: No interval.
Step 3: The domain is filtered to remove "out of domain" values.
- Type: Sedan, Compact, Sport
- HorsePower: 100, 200, 300, 350, 500
- Color: Red, Green
At runtime, the following domain will be available:
- Type: Sedan, Sport
- HorsePower: 100, 200
- Color: Red
As explained previously, the LIKE operator is not used to list domain values (so values defined with the LIKE operator are not part of the initial domain). If you want to ensure that some values are part of the domain, you need to list these values in a dedicated table (with the = operator).
Table 1
| TYPE (STRING) | HORSEPOWER (INTEGER) | ||
|---|---|---|---|
| = | Sedan | LIKE | 100 |
| = | Sedan | = | 200 |
| TYPE (STRING) | HORSEPOWER (INTEGER) | ||
|---|---|---|---|
| = | Sedan | = | 500 |
| = | Compact | = | 300 |
| = | Compact | = | 350 |
| = | Sport | = | null |
Table 2
| TYPE (STRING) | HORSEPOWER (INTEGER) | ||
|---|---|---|---|
| = | Red | = | 100 |
| = | Red | = | 200 |
| = | Green | LIKE | 400 |
Table 3
| HORSEPOWER (INTEGER) | |
|---|---|
| = | 100 |
| = | 200 |
| = | 4001 |
In this case, 4001 is now part of the initial domain and compatible with Sport and Green.
Leveraging the Dynamic Filter Service to Ensure Error-Free Quotes
Once the domain and compatibility between values are defined by the administrator, at runtime, the dynamic filter service helps the user to select only valid values.
When the Type is not selected, all values are valid.
Then, as soon as a type is selected, some values appear now as invalid (represented in red).
Red values can be hidden from the selector or with a setting in the quote model.
When an invalid value is selected, all the columns part of the dynamic filter are in error.
When all values of a domain are not listed (for example when the > (greater than) operator is used), there is no dropdown displayed.
Example 5 using intervals will be rendered as following at runtime.
In that case, the domain will be validated once the user sets the value (in the screen below, 400 is invalid for Compact type).
