How To Filter Records and Apply Conditions at Record Level using For-Each Property

The For-Each property is used to repeat the occurrences of a target element or node, depending on the total occurrences of a source element or a node in the source file.
For example, an XML schema with a node customer has three elements, first_name, last_name, and state. This schema is used both at the source and at the target end.

Supposing, the source file has 10 occurrences of the customer. Applying the For-Each property on the target node customer, for the source node customer, generates an output file containing 10 occurrences of the customer in it.

Below are the use cases of the For-Each function and are described in the attached document.

Use Case 1: Filtering records from a single source file

Filters require a qualified For-each condition that has a condition (also called a predicate). For-each condition is available under the Properties tab in the Mapping Expression panel.

Use Case 2Joining data from two source files

We want to select the matching Payroll data from Source 2 by using Source 1’s SSN (common key). So, we will traverse through Source 1, get SSN for each record (in a variable) and go and look up into Source 2 and find the matching data.

Use Case 3: Finding Delta between two files

We want to find delta between two Master data files and select only the Updated and New records.

Use Case 4Joining data from two branches within a single file

We want to select the matching Payroll data from Record Type 2 by using Record Type 1’s SSN (common key). Suppose the Target’s Record branch needs Payroll data. So, we will traverse through Record Type 1, get SSN for each record (in a variable) and go and look up into Record Type 2 and find the matching data.

 

Reference: 

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.