Behaviors of filters using multiple conditions and predicates in Talend MDM
To filter data according to your needs, you can define multiple conditions using different operators, which can be combined using different predicates (Or, And, Not).
When using filters, pay attention to the following:
-
The predicates are applied to the conditions according to their sequential order. For example, if a user defines four conditions of a, b, c, d in the following order:
a Or b And c Or d None
The predicates are applied to the conditions in this way: (((a Or b) And c) Or d).
-
When multiple conditions are used, if the last predicate is "None", it is equivalent to "And".
-
When defining a condition, you can set the value of the type String with or without double quotes.
This article applies to Talend MDM release 6.3.0 and above.
For more information about the operators, see the Talend MDM Platform Studio User Guide.
Examples of filters using multiple conditions and predicates in Talend MDM
An example of a filter with multiple conditions from one View
For example, a user defines three conditions C1, C2 and C3 in a view as follows:
XPath | Operator | Value | Predicate | Condition Alias |
---|---|---|---|---|
ProductFamily/Id | >= | "2" | And | C1 |
ProductFamily/Id | <= | "5" | Or | C2 |
ProductFamily/Id | = | "9" | None | C3 |
The three conditions are combined to be ((C1 And C2) Or C3), which means the queried data in the view must have a product family id between 2 and 5 or equal 9.
An example of a filter with multiple conditions from two Roles
You can combine different filters that are defined to be applied to the same View.
For example, a user is assigned two roles RoleFinance and RoleLogistics successively, which have different filters on the same View ProductFamily of the entity ProductFamily.
The filters in the first role RoleFinance are defined with two conditions C1 and C2 as follows:
XPath | Operator | Value | Predicate | Condition Alias |
---|---|---|---|---|
ProductFamily/Id | > | "3" | And | C1 |
ProductFamily/ChangeStatus | Contains | "Pending" | Or | C2 |
The filters in the second role RoleLogistics are defined with two conditions C3 and C4 as follows:
XPath | Operator | Value | Predicate | Condition Alias |
---|---|---|---|---|
ProductFamily/Id | < | "5" | And | C3 |
ProductFamily/ChangeStatus | Contains | "Completed" | None | C4 |
The filters from the two roles are combined to be (((C1 And C2) Or C3) And C4).
When a user having the two roles (RoleFinance and RoleLogistics) queries data with the view ProductFamily, since the change status of a product family cannot be "Pending" and "Completed" at the same time, no data will be returned.