Merge - Merge two lists of objects
This action receives two lists of objects and creates a single merged
list, in which each object contains the content of one object from the first
input list and the content of the matching object from the second list.
Matching between objects is defined as identity of corresponsing elements.
For example, if both the data type of the objects in the first list and
the data type of the objects in the second list contain fields named
First Name and Last Name, then an object from the first
list matches an object in the second list if (and only if) both have
the same values of First Name and Last Name.
If an object has a matching object in the other list, then the two are
merged to create a single output object, which contains some or all of the
elements of the two merged objects (the elements used to define the matching
are copied to the output only once).
If an object has no matching object in the other list, then the output
object is created by copying only the elements that exist in this object
(and the other elements are left empty).
The output objects are sorted in "lexicographic order" according to the
matching elements (compare with Sort).
If the matching elements appear in different order in each of the two
input lists, ordering is done according to the order in the first list.
The action's template has a two required repetitive triggers
(<List 1> and <List 2>), the data type of each
being a composite data structure (it makes no sense to use this action with
non-composite data types). The data types of the two triggers may be identical
Notice that it is assumed that none of the input lists contains multiple
objects that match each other (otherwise it won't be clear which of
them matches the matching object(s) from the other list). In the above
example, neither <List 1> nor <List 2> may contain
more than one object with the same First Name and the same Last Name
(the matching elements are used as a "primary key" for identifying the objects
in the lists).
<Merged List> (repetitive exit [required]): A list
of merged objects (sorted lexicographically according to the elements
that appear both in the data type of <List 1> and the data
type of <List 2>).
The data type of <Merged List> is also a composite data structure,
which may contain several types of elements:
Notice that <List 1>, <List 2> and
<Merged List> may all have the same data type. This may be
used to merge two lists with identical structures, each "contributing"
content to some data elements.
"Common/Templates/Collections/Merge/Test1/Merge - Basic Test":
- An element whose name and type are identical to those of one of the
elements that appear in both <List 1> and <List 2>
(and thus used to match objects between the two input lists).
In the above example, the output object may contain a First Name
element, a Last Name element, or both (it may also contain
none of them, although it usually makes sense for the output to contain
all elements used for matching the inputs). Any such element in the output
object will have the same value as the correspnsing elements in the two
input objects from which it has been created (as these two values are
identical, the value is copied to the output only once).
- An element whose name and type are identical to another elements in either
<List 1> or <List 2>. Any such element in the
output will have the same value as the correponding element in the
input object from which it has been created.
- Additional elements. Any such element in the output will be empty
(as there is no correponding element in the input).