Partial update with Overwrite enabled or disabled - 7.3

MDM data processing

author
Talend Documentation Team
EnrichVersion
Cloud
7.3
EnrichProdName
Talend Data Fabric
Talend MDM Platform
task
Data Governance > Third-party systems > MDM components > MDM data processing components
Data Quality and Preparation > Third-party systems > MDM components > MDM data processing components
Design and Development > Third-party systems > MDM components > MDM data processing components
EnrichPlatform
Talend MDM Server
Talend MDM Web UI
Talend Studio

The following two examples explain how to add some elements to an existing item (entity) with multi-occurrence elements (attributes) and then update the newly added elements based on the content of a source XML stream.

Given an existing item as follows:

<Person>
	<Id>1</Id>
	<Name>p1</Name>
	<Houses>
		<House>[1]</House>
		<House>[2]</House>
		<House>[3]</House>
	</Houses>
	<Children>
		<Child>
			<Name>k1</Name>
			<Age>1</Age>
			<Habits>
				<Habit>Basketball</Habit>
				<Habit>Football</Habit>
				<Habit>Tennis</Habit>
				<Habit>Boxing</Habit>
			</Habits>
		</Child>
	</Children>
<Person>

Example 1: If you want to add two Child items to the existing item, then the Xpath you enter in the Pivot field must read as follows: /Person/Children/Child where the Overwrite check box is cleared, and the Key field is set to /Name. Note that the Child element is of complex type, and needs to be identified with the Key field. Moreover, you need to provide the source XML stream as follows:

<Person>
	<Id>1</Id>
	<Children>
		<Child>
			<Name>k2</Name>
		</Child>
		<Child>
			<Name>k3</Name>
		</Child>
	</Children>
</Person>

In this case, the two child items Child [k2] and Child [k3] will be added, and you will get the following result:

<Person>
	<Id>1</Id>
	<Name>p1</Name>
	<Houses>
		<House>[1]</House>
		<House>[2]</House>
		<House>[3]</House>
	</Houses>
	<Children>
		<Child>
			<Name>k1</Name>
			<Age>1</Age>
			<Habits>
				<Habit>Basketball</Habit>
				<Habit>Football</Habit>
				<Habit>Tennis</Habit>
				<Habit>Boxing</Habit>
			</Habits>
		</Child>
		<Child>
			<Name>k2</Name>
		</Child>
		<Child>
			<Name>k3</Name>
		</Child>
	</Children>
</Person>

Example 2: If you want to change the names of the two child items Child [k2] and Child [k3], then the Xpath you enter in the Pivot field must read as follows: /Person/Children/Child where the Overwrite check box is selected, and the Key field is set to /Name. Moreover, you need to provide the source XML stream as follows:

<Person>
	<Id>1</Id>
	<Children>
		<Child>
			<Name>Tina</Name>
		</Child>
		<Child>
			<Name>Tommy</Name>
		</Child>
	</Children>
</Person>

In this case, the names of the two child items Child [k2] and Child [k3] will be updated, and you will get the following result:

<Person>
	<Id>1</Id>
	<Name>p1</Name>
	<Houses>
		<House>[1]</House>
		<House>[2]</House>
		<House>[3]</House>
	</Houses>
	<Children>
		<Child>
			<Name>k1</Name>
			<Age>1</Age>
			<Habits>
				<Habit>Basketball</Habit>
				<Habit>Football</Habit>
				<Habit>Tennis</Habit>
				<Habit>Boxing</Habit>
			</Habits>
		</Child>
		<Child>
			<Name>Tina</Name>
		</Child>
		<Child>
			<Name>Tommy</Name>
		</Child>
	</Children>
</Person>