on 02-27-2019 8:32 AM
Hello,
I have a File to File scenario and have a mapping requirement between below shown Source and Target structures:
The Employee IDs in the source structure should be grouped together as per their Departments in the Target structure.
Any idea on how this can be achieved in message mapping?
Thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Abhishek;
You can use this mapping.
Item
Emp_ID
Department
concatContextValues UDF
if (delimiterString == null || delimiterString.length == 0) {
throw new IllegalStateException("concatContextValues: "
+ "there is no delimiterString");
}
if (contextValues != null && contextValues.length > 0) {
String delimiter = delimiterString[0];
StringBuffer sb = new StringBuffer(contextValues[0]);
for (int i = 1; i < contextValues.length; i++) {
sb.append(delimiter).append(contextValues[i]);
}
result.addValue(sb.toString());
}
Test Result
Regards
Hasan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use multiple mapping.
1) In the first MM - use format by example so that you can get data like below -
<Item>
<Emp_ID> 1111 </Emp_ID>
<Emp_ID> 2222 </Emp_ID>
<Department> Sales </Department>
</Item>
<Item>
<Emp_ID> 4444 </Emp_ID>
<Emp_ID> 6666</Emp_ID>
<Emp_ID> 9999</Emp_ID>
<Department> Accounting</Department>
</Item>
2) In the second MM, Write a simple UDF to concat EMP_ID values separated by coma and put into the final structure.
Thanks,
Apu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.