Condition based String Concatenation
Today I came across a typical mapping Scenario which would be worth having a look.
The input message has a repeating record (“RepeatingRecord” in the below image), which has a Qualifier (“Qual” in the below image), and a string node (“String” in the below image). Schema looks something like below.
Here the “Main” record can occur Multiple times & “RepeatingRecord” can occur Multiple times.
Sample input message will be like below.
Requirement now is whenever the “Qual” equals “10” throughout the whole input message, the corresponding String node values have to be concatenated.
From the resultant concatenated string, the first 3 characters should be mapped to a field in Target Message and the next 3 characters to another field. Target Schema looks something like below.
Target message should be something like below.
Here are the steps to achieve the mapping.
- Have a Logical Equal Functoid and Set one value to “Qual” node and another value to “10”.
- Have a Value Mapping Functoid and set one value to Logical Equal Functoid of step1 and another value to String node.
- Connect the output of Value Mapping to the Cumulative Concatenate Functoid.
- The output of Step3 gives the Concatenated String for the whole input message where “Qual” is 10.
- Use String Extract Functoid to get the First 3 & next 3 characters and Map to the Target schema.
Though this is not a complex logic, it gives you some idea on using Conditional Cumulative Functoids.
Condition based String Concatenation