Skip to main content
Skip table of contents

Merge: merge the content of two lists

Tag: Merge

The Merge function adds to each element in a target list the corresponding element in the source list.

Detailed Description

A list content can be copied element by element to another list.

The merge can be done blindly or by key.

In blind mode, elements in the source list are copied to the element at the same index in the target list.

Example 1: source list A contains 10 elements with entries X, and Y. Target list B contains 5 elements Z and K.

After merge, B contains 5 elements X, Y, Z and K.

Example 2: source list A contains 5 elements with entries X, and Y. Target list B contains 10 elements Z and K.

After merge, B contains 5 elements X, Y, Z and K, and 5 elements Z and K.

In key mode, the elements are bound by the key value and the corresponding elements form source are copied to target.

Example: source list A contains 5 elements X and Y, target list B contains 10 elements X and K.

After merge with key X, contains 10 elements X, K and Y, with Y values copied from source where values of X match between A and B.

Tag Attributes

Attributes

Value Description

Source

Any string to ID the origin list (required)

Target

Any string to ID the destination list (required)

KeyEntry

Name of entry to match elements between source and target (not required)

If omitted or blank, the merge is performed in blind mode.

Example Script

CODE
<ytriaAutomation>
	
    <SplitIntoSetVarList ListName="List1" separator=":" var1="A:B:C:D:E:F"/>
    <SplitIntoSetVarList ListName="List2" separator=":" var2="1:2:3::5"/>

blind mode: add values from List2 to List1
	<Merge Source="List2" Target="List1"/>
	<Loop list="List1">
		<ExecuteListAction/>
	</Loop>	


    <SplitIntoSetVarList ListName="List10" separator=":" var1="A:X::C:D:E" var2="a:x:!:c:d:e"/>
    <SplitIntoSetVarList ListName="List20" separator=":" var1="A:B:C:D:E:F" var3="1:2:3:4:5:6"/>

key mode: add values from List20 to List10 where var1 match in both lists
	<Merge Source="List20" Target="List10" keyEntry="var1"/>
	<Loop list="List10">
		<ExecuteListAction/>
	</Loop>	

		
</ytriaAutomation>

image-20240405-000322.png

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.