webMethods 10.2 | Service Development Help | Mapping Data in Flow Services | Mapping Using ForEach | ForEach Mapping Rules
 
ForEach Mapping Rules
The following tables identify the default ForEach mapping rules for array variables.
The example below illustrates a ForEach mapping between Employee (input array) and Person (output array).
1. In a ForEach mapping, you cannot link the individual array elements in a Pipeline view. To do this, you must expand the ForEach mapping. Also, you can build aForEach mapping from a nested input array, only if parent array is part of ForEach mapping.
Following table identifies the possible cases in Pipeline view.
From...
To...
Then…
/Employee/id
/Person/name
This is an invalid link.
Employee and Person arrays are already part of ForEach mapping. To create this link, go to the Pipeline view of the ForEach mapping.
Age
Person/age
This is an invalid link.
Person is part of current ForEach mapping but Age is not.
To create this link, go to the Pipeline view of the ForEach mapping.
Employee
Location
This is a valid ForEach mapping.
Single input array (Employee) to multiple output array (Location and Person).
CTC
Person
This is a valid ForEach mapping.
Multiple input arrays (CTC and Employee) to single output array (Person).
Employee
Products
This is an invalid ForEach mapping.
Employee and Products are of different data types.
Employee/address
Person/city
This is an invalid ForEach mapping.
Employee and Person are already part of current ForEach mapping.
To establish this nested ForEach mapping, go to the Pipeline view of the ForEach mapping.
RnD/products
Products
This is an invalid ForEach mapping.
RnD is not part of any ForEach mapping.
To establish this nested ForEach mapping, add a ForEach mapping for RnD in the Pipeline view and then go to the Pipeline view of the ForEach mapping.
2. In the Pipeline view of the ForEach mapping, a link is allowed only if the source variable, target variable, or both the variables are part of the current ForEach mapping array elements.
Following table identifies the possible cases in the Pipeline view of the ForEach mapping.
From...
To...
Then…
/Employee/id
Age
This is a valid link.
Employee/id is part of the current ForEach mapping.
/Employee/id
Person/name
This is a valid link.
Employee and Person arrays are part of ForEach mapping.
Experience
Person/age
This is a valid link.
Person/age is part of ForEach mapping.
RnD/products
Products
This is an invalid link.
RnD is not part of parent ForEach mapping (Employee>Person).
To create this link, go back to Pipeline view of MAP step.
3. In the Pipeline view of the ForEach mapping, you can build a nested ForEach mapping only from those input array elements that are part of the parent ForEach mapping.
Following table identifies the possible cases:
From...
To...
Then…
/Employee/address
Person/city
This is a valid nested ForEach mapping.
Employee/address is an element of parent ForEach mapping.
/Employee/address
Location
This is a valid nested ForEach mapping.
Employee/address is an element of parent ForEach mapping.
RnD
Department
This is an invalid nested ForEach mapping.
RnD is not an element of parent ForEach mapping (Employee).

Copyright © 2017-2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Innovation Release