Adding a foreign key filter - Cloud - 7.3

Talend Studio User Guide

Version
Cloud
7.3
Language
English
Product
Talend Big Data
Talend Big Data Platform
Talend Cloud
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Real-Time Big Data Platform
Module
Talend Studio
Content
Design and Development
Last publication date
2024-02-13
Available in...

Data Fabric

MDM Platform

One of the most useful annotations that you can set up on any of the attributes (elements) of the business entities in a data model is the foreign key filter.

Through this annotation, you can filter foreign keys by:

  • values extracted from the current record through using the standard XPath predicate of the relevant attribute,

  • complex expressions: literal and functions,

  • current record values and complex expressions.

Note that if the filter is not an XPath but a value, it needs to be enclosed in quotes (").

Note: Custom filters for foreign keys are not supported when you use a SQL database to store your data records.

Before you begin

You have already created data models, business entities and attributes in the data model. For further information, see Creating a data model, Creating business entities in a data model and Adding attributes to the business entity.

About this task

Consider as an example that your data records hold the following entities: Agency, Agent and Region. The Agency and Region entities hold the Country attribute. In Talend MDM Web UI, you want to filter the foreign key values by the Country attribute.

To set a foreign key filter, do the following:

Procedure

  1. Right-click the attribute to which you want to add the annotation, Agency > Region in this example.
  2. In the contextual menu, select Set the Foreign Key Filter.

    A dialog box displays.

  3. Click the icon to add a line to the table where you can define the foreign key filter.
  4. Click in the XPath column and then click the three-dot button to open a dialog box where you can select the XPath on which to set the foreign key filter.
  5. Select Region > Country and then click Add in the dialog box.

    The XPath is set to Region/Country.

  6. Click in the Operator column and select an operator from the list, Contains in this example.
  7. Click in the Value column and then click the three-dot button to open a dialog box where you can select the value on which to set the foreign key filter.
  8. Select Agency > Country and then click Add in the dialog box.

    The foreign key filter value is set to Agency/Country.

    Note: You can also use the function with the XPath predicate of a relevant attribute to set the foreign key filter value, for example, fn:abs(Product/Price). The XPath predicate of a String type attribute needs to be prepended with xpath:, for example, fn:concat("xpath:Agency/Country","sample"). All supported functions can be found in the Expression area for setting a default value rule. For more information, see Setting a default value rule for an element.
  9. If required, add multiple conditions and combine them using various predicates.
  10. In this example, you want to filter foreign keys based on the Country attribute. Click OK to close the dialog box.

    The defined foreign key filter is displayed under the Annotation node of the Region element.

  11. Click the save icon on the toolbar or press Ctrl + S on your keyboard to save your modifications.

What to do next

Now in any agency record in Talend MDM Web UI, every time a user clicks on the foreign key icon next to the Region field, the list will only include the foreign keys based on the Country attribute.