This scenario describes a two-component Job that generates a data record, transforms it into XML and loads it into the defined business entity in the MDM server.
In this example, we want to load a new agency in the Agency business entity. This new agency 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.
Preparing the data to be loaded into 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 you want to write on the MDM server.
Click the [+] button and add five columns of the type String.
In this example, name the columns Id, Name, Office_R_and_D, Office_Sales, and Office_Services.
Click OK to validate 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 between quotes the values which correspond to each of the schema columns.
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 the [...] button next to the Edit Schema field to define the structure of the master data you want to load into the MDM server.
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.
Select the Is Update checkbox if you only want to update some fields rather than the entire data record.
If you want to use this component to write on the MDM server a task resolved in Talend Data Stewardship Console, select the Add task id check box, and then enter the ID of your choice or select the schema column you want to use as the ID.
In this case, the MDM record on the MDM server will have a track back to the resolved task fetched from Talend Data Stewardship Console. For further information, see Talend Data Stewardship Console User Guide.
Advanced settings of tMDMOutput
In the Component view, click Advanced settings to set the advanced parameters for the tMDMOutput component.
Select the Extended Output check box if you want to commit master data in batches, and specify the number of lines per batch in the Rows to commit field.
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 into which you want to insert the data record, Agency in this example.
In the Linker source area, select the two schema columns Id and Name and drop them on the Agency node respectively.
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 three new sub-elements 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 three schema columns Office_R_and_D, Office_Sales and Office_Services and drop them on the three new Office nodes respectively.
The [Selection] dialog box is displayed.
Select the Create as sub-element of target node option so that the three columns are linked to the three XML sub-elements 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.
Press Ctrl+S to save your Job.
Execute the Job by pressing F6 or clicking Run on the Run tab.
The new data record is inserted in the Agency business entity in the DStar data container on the MDM server. This data records holds, as you defined in the schema, the agency id, the agency name and the agency offices located in three cities.