The scenario describes how to partially remove the master data which has been written into the MDM server in the scenario Scenario: Writing master data in an MDM hub.
In this example, one agency office will be removed from the Agency business entity. The agency now has an id, a name and three offices located in different cities.
For more information about entities, see Talend Studio User Guide.
From the Palette, drop tFixedFlowInput and tMDMOutput onto the design workspace.
Connect the components using a Row Main link.
Specifying the data to be removed from the MDM server
Double-click tFixedFlowInput to view its Basic settings in the Component tab.
In the Schema list, select Built-In and then click the three-dot button next to Edit schema to open a dialog box in which you can define the structure of the master data to be used for partially removing the master data on the MDM server.
Click the [+] button and add three columns of the type String.
In this example, name the columns Id, Name, and Remove_Office.
Click OK to save your changes.
In the Number of rows field, enter the number of rows you want to generate.
In the Mode area, select the Use Single Table option.
In the Value fields, enter values which correspond to each of the schema columns.
In this example, the office in Paris will be removed.
Basic settings of tMDMOutput
In the design workspace, click tMDMOutput to open its Basic settings view.
In the Input Schema list, select Built-In and then click Sync columns.
After receiving data from the previous component, the tMDMOutput component basically generates an XML document, writes it in an output field, and then sends it to the MDM server.
Click OK to proceed to the next step.
The Result of the XML serialization list in the Basic settings view is automatically filled in with the output xml column.
In the URL field, enter the URL to access the MDM server.
In the Username and Password fields, enter the authentication information required to connect to the MDM server.
In the Data Model field, enter between quotes the name of the data model against which you want to validate the master data you want to write.
In the Data Container, enter between quotes the name of the data container into which you want to write the master data.
In the Partial Update area, select the Use Partial Update check box.
In the Source Name field that pops up with your selection, enter the name to be used in the modification report.
In the Pivot field, enter the xpath to the multi-occurrence sub-element where data need to be removed.
In this example, enter "Agency/Offices/Office".
Select the Delete check box, and then enter "." in the Key field.
Advanced settings of tMDMOutput
In the Component view, click Advanced settings to set the advanced parameters for the tMDMOutput component.
Click the [...] next to Configure XML Tree to open the tMDMOutput editor.
Alternatively, double-click tMDMOutput to open the editor.
In the Link target area to the right, click in the XML Tree field and then replace rootTag with the name of the business entity in which you want to remove data partially, Agency in this example.
In the Linker source area, select the two schema columns Id and Name and drop them on the Agency node.
The [Selection] dialog box is displayed.
Select the Create as sub-element of target node option so that the two columns are linked to the two XML sub-elements of the Agency node.
Right-click the root node Agency and then select Add Sub-element.
In the dialog box that pops up, enter a name for the new sub-element, Offices in this example.
Repeat the same procedure to create a new sub-element Office for the Offices node which corresponds to the multi-occurence element Offices of the business entity Agency.
In the Linker source area, select the schema column whose corresponding data entry you want to remove, Remove_Office in this example, and drop it on the new Office node.
The [Selection] dialog box is displayed.
Select the Create as sub-element of target node option so that the column is linked to the XML sub-element of the Offices node.
Click Ok to proceed to the next step.
Right-click the element in the Link Target area you want to set as a loop element and select Set As Loop Element from the contextual menu.
In this example, Id is the iterating object.
Click OK to validate your changes and close the dialog box.