Behaviors of filters using multiple conditions and predicates in Talend MDM - 8.0

Version
8.0
Language
English (United States)
Product
Talend Data Fabric
Talend MDM Platform
Module
Talend MDM Server
Talend MDM Web UI
Talend Studio
Content
Data Governance > Filtering data
Data Quality and Preparation > Filtering data

Behaviors of filters using multiple conditions and predicates in Talend MDM

In Talend MDM, when defining views, roles, foreign key filters, or retrieving or deleting data using the component tMDMInput, tMDMViewSearch or tMDMDelete, you are allowed to add as many conditions as needed to filter data you want to query.

To filter data according to your needs, you can define multiple conditions using different operators, which can be combined using different predicates or, and, and not.

Behaviors of filters in views

You can combine different search conditions when defining a view.

When using multiple conditions and predicates in a view, pay attention to the following:

  • The predicates Or, And, and Not are now available for use.
  • The Not predicate does not work if there are multiple conditions.
  • When multiple conditions are defined, the or or and predicate on the last condition is not used to combine conditions.
  • The predicates are applied to the conditions according to their sequential order. For example, if four conditions C1, C2, C3, C4 are defined in the following order:
        C1    and
        C2    or
        C3    and
        C4    none

    The predicates are applied to the conditions in this way (((C1 and C2) or C3) and C4).

  • The value of the String type can be entered with or without double quotes when defining a condition.

Below is an example of using multiple conditions and predicates in a view. Three conditions C1, C2 and C3 are defined in a view as shown in the table, and they are combined to be ((C1 and C2) or C3), which means only the product family records whose ID is between 2 and 5 or equal 9 will be returned.

XPath Operator Value Predicate Condition Alias
ProductFamily/Id >= "2" and C1
ProductFamily/Id <= "5" or C2
ProductFamily/Id = "9" none C3

Behaviors of filters in roles

You can combine different filters that are defined to be applied to the same view.

Pay attention to the following when using multiple conditions and predicates in roles:

  • The predicates Or, And, and Not are now available for use.
  • The Not predicate does not work if there are multiple conditions.
  • When multiple conditions are defined, the or or and predicate on the last condition is not used to combine conditions.
  • The predicates are applied to the conditions according to their sequential order. For example, if four conditions C1, C2, C3, C4 are defined in the following order:
        C1    and
        C2    or
        C3    and
        C4    none

    The predicates are applied to the conditions in this way (((C1 and C2) or C3) and C4).

  • The value of the String type can be entered with or without double quotes when defining a condition.

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.

Behaviors of filters for setting the foreign key filter

You can define as many conditions as needed when setting the foreign key filter.

When setting the foreign key filter using multiple conditions and predicates, pay attention to the following:

  • The predicates Or, And, and Not are now available for use.
  • The Not predicate is applied only to the condition on which it is defined.
  • When multiple conditions are defined, the or or and predicate on the last condition is not used to combine conditions.
  • When multiple conditions are used, if the Not predicate is defined on a condition except the last condition, the And predicate is used to combine the condition on which the Not predicate is defined and its next condition.
  • The predicates are applied to the conditions according to their sequential order. For example, if four conditions C1, C2, C3, C4 are defined in the following order:
        C1    and
        C2    or
        C3    not
        C4    none

    The predicates are applied to the conditions in this way (((C1 and C2) or (not C3)) and C4).

  • The value of the String type can be entered with or without double quotes when defining a condition.

Below is an example of using multiple conditions and predicates when setting the foreign key filter. Four conditions are defined in a foreign key filter as shown in the table, and they are combined to be (((C1 or C2) or (not C3)) and C4), which means only the foreign key values whose name contains Shirt or Hat, or does not contain Talend, and change status contains Pending will be filtered.

XPath Operator Value Predicate Condition Alias
ProductFamily/Name Contains "Shirt" or C1
ProductFamily/Name Contains "Hat" or C2
ProductFamily/Name Contains "Talend" not C3
ProductFamily/ChangeStatus Contains "Pending" none C4

Behaviors of filters in MDM components

You can combine several search conditions in the component tMDMInput, tMDMViewSearch or tMDMDelete to retrieve or delete data in Talend MDM.

When using multiple conditions and predicates in Talend MDM components, pay attention to the following:

  • The predicates none (default), or, and, and Not are now available for use. The other predicates are reserved for future.

  • The none predicate is interpreted as and by default.
  • The Not predicate is applied only to the condition on which it is defined.
  • When multiple conditions are defined, the or or and predicate on the last condition is not used to combine conditions.
  • The or predicate is interpreted only if it is defined on all conditions, except the last condition. Otherwise the or predicate is always interpreted as and, and all conditions are combined using the and predicate.
  • The predicates are applied to the conditions according to their sequential order. For example, if four conditions C1, C2, C3, C4 are defined in the following order:
        C1    and
        C2    or
        C3    not
        C4    none

    The predicates are applied to the conditions in this way (((C1 and C2) and (not C3)) and C4).

  • All values need to be entered between double quotes when defining a condition.

Below are several examples of using multiple conditions and predicates in Talend MDM components.

Example 1: The following four conditions are combined and interpreted as (((C1 and C2) and C3) and C4), which returns all products whose name contains Talend and Shirt, and price is greater than 10 and is less than 20.

XPath Operator Value Predicate Condition Alias
Product/Name Contains "Talend" or C1
Product/Name Contains "Shirt" and C2
Product/Price > "10" or C3
Product/Price < "20" none C4

Example 2: The following four conditions are combined and interpreted as (((C1 and C2) and (not C3)) and C4), which returns all products whose name contains Shirt, price is greater than 15 and not equal to 15.99, and family equals 1.

XPath Operator Value Predicate Condition Alias
Product/Name Contains "Shirt" or C1
Product/Price > "15" or C2
Product/Price = "15.99" not C3
Product/Family = "1" none C4

Example 3: The following four conditions are combined and interpreted as (((C1 or C2) or C3) or C4), which returns all products whose name contains Shirt or Hat, or price is less than 10 or greater than 20.

XPath Operator Value Predicate Condition Alias
Product/Name Contains "Shirt" or C1
Product/Name Contains "Hat" or C2
Product/Price < "10" or C3
Product/Price > "20" none C4