How to create a Talend MDM trigger to standardise telephone numbers

by | Jun 2, 2015 | BlogPosts, Tech Tips | 0 comments

A fundamental principle of Talend Master Data Management (MDM) is data quality and data governance and the specific trigger functionality is a great way to automatically execute events on record creates and updates. However, getting started with trigger functionality can be a bit tricky if you have no prior experience with Talend MDM, so I thought it suitable to demonstrate how to create an MDM trigger that standardises the format of customer telephone numbers.

It isn’t necessary to follow some of the steps precisely – for example, you may want to use a different data model or name attributes in a different way – but the following article ought to assist you by improving your knowledge of Talend MDM and it’s trigger functionality capacity.

Begin with creating a data model similar to the example below:

2015-05-26 Blog - Image 1

Create a new job named Standardise_phone_numbers or similar.

Use the Retrieve Entity feature in the database connection under Metadata in the Repository to import the Input schema for the Country entity. The country entity is required for this demo because the tStandardizePhoneNumber component uses the Country ISO 2 code to determine the format the telephone number should be in.

2015-05-26 Blog - Image 2

Create another schema repository item for CustomerOut and CustomerReceive. CustomerReceive should be configured as follows:

2015-05-26 Blog - Image 3

Connect a tMDMTriggerInput in a tXMLMap with a tMDMInput. The tMDMInput should be dragged from the repository. The CountryIn entity can be set up in a similar way to the CustomerOut and CustomerRecieve.

2015-05-26 Blog - Image 4

In the tXMLMap, import the CustomerReceive schema from the repository for the MDM_Message:

2015-05-26 Blog - Image 5

2015-05-26 Blog - Image 6

Now create an inner join between CountryFK and CountryId encapsulated in the MDM.getFK notation, i.e:

MDM.getFK([CustomerIn.MDM_Message:/exchange/item/Customer/CustomerAddresses/CustomerAddress/CountryFK],0).

Note the “,0” at the end (This denotes the first column of the key when composite keys are used)

Create a new output. Create a column with data type of Document and two columns with a data type of String, one named CountryISO2 and another PhoneNumber. Import the CustomerOut Schema from the repository for the Document column. Map the data as follows:

2015-05-26 Blog - Image 7

Connect the output from the tXMLMap to a tStandardizePhoneNumber component. Ensure the Phone number and Country code are mapped to the correct columns. The output format is set to International in this example but National or E164 may be selected depending on preference.

2015-05-26 Blog - Image 8

Next, connect the output from the a tStandardizePhoneNumber with a tXMPMap. Create an output with a column of data type Document and then import the CustomerOut schema for both the input and the output document columns in a similar way as the CustomerReceive. Below is a snapshot of how to map the data; essentially it’s a one to one mapping, but with the PhoneNumber mapped from the StandardizedPhoneNumber column. There is other information generated from the  tStandardizePhoneNumber component such as whether it’s home or mobile, which can be made use of if desired.

2015-05-26 Blog - Image 9

Connect the output with a tMDMOut component. Again, it is quicker to set this up and take from the repository rather than take from the pallet and setup manually.

Untick Build the document, select Is Update and select Fire a Create/Update event so that a journal entry is created. The configuration should look the same as the snapshot below:

2015-05-26 Blog - Image 10

Next we must setup the MDM trigger, so after you have saved your job, switch over to the the MDM perspective.

Create a new Trigger under the Event Management section within the MDM perspective.

Set the Entity to Update (Update is the table in the MDM database that records the journal records (update report).

Set the URL by clicking ‘Open Job’ and selecting the job Standardise_phone_numbers.

Set the Context Name to xml_input and the value to {exchange_data}.

Set the Trigger xPath Expressions to: Update/OperationType = CREATE and also another for UPDATE, then set a value for the Condition Id eg U1 and U2.

Add another for Update/DataModel = Customers and another for Update/Concept = Customer. The condition should then be set to (U1 or U2) and (U3 and U4).

2015-05-26 Blog - Image 11

Now we are ready to deploy both the trigger and the job Standardise_phone_numbers to the MDM server. This is done in a similar way to how you would deploy any artefacts to the MDM server. Note: the job should be deployed as a Hosted (Zip).

2015-05-26 Blog - Image 12

To test the newly created functionality, navigate to the MDM web UI. Create a new record for Country. In this example we use GB. Create a new record for Customer then enter a phone number and select the Country.

2015-05-26 Blog - Image 13

Save the record and refresh the view to see the phone number format update!

2015-05-26 Blog - Image 14

Journal entry for the update:

2015-05-26 Blog - Image 15

Now that you’ve created your first Talend MDM trigger, you have a re-usable method for creating more triggers that can perform data cleansing, data enrichment and data distribution within your MDM implementation.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *