useOneAsMany is a very useful function to repeat header level-like data, as many time as needed at detail-level data, and still follow desired context change pattern.
It is difficult to explain this function using words and sentences only, let’s understand this function by using a easy example.
Below are the source message type and target message type. Source message type is tree structure, and target message type is flat structure.
The objective of this mapping is to convert all book in tree structure into book in flat structure. Below is the test data and the expected output result:
Let’s take a look at the queue of each fields:
Map the first target field which is ‘row’ field. The ‘row’ should be repeated for each book, so map the ‘Book’ field to ‘row’. The ‘Book’ field should be mapped regardless of the context change, so add removeContext function before map to ‘row’.
Map the CatID field. The challenge here is CatID total have 3 values only, but need to map to total 6 values because total have 6 books. Each CatID need to repeat how many time correctly? and total is 6 and still match each book’s category correctly? useOneAsMany come to rescue.
We can map the CatID like below:
First input parameter supply the value will be mapped, so choose CatID.
Second input parameter supply the information for each CatID need to repeat how many time. Choose Book.
Third input parameter supply the template of context change will be used on output. Choose BookID.
Below condition must be fulfilled:
To further explain in graphical way:
Same logic applied for CatName
For BookID and BookName,is direct one to one mapping only:
Hope my explanation is clear and understandable. Cheers!
Beautifully explained node function useOneAsMany. Really appreciate your efforts.
Thank You.
Regards,
Ajit
Hi Ajit,
Thanks for your kind words. 🙂
Regards,
Yee Loon
Really awesome and easy to understand. Thank you.
Keep the good work.
Regards,
Sachin
Great Explanation. Really helpful. Thank You!!
Hi,
This is a great explanation.
Its very clear and detailed.
Thanks for all the effort.
Regards
Anurag
Good Explanation 🙂
Well explained
very clear
Awesome Explanation….Keep rocking…. 🙂
Regards,
Venki
thanks forexplaing in detail.
Brillians
very good. thanks a lot!
Verry good work, You really helped me to understand this subject
thanks a lot
Thank you very much. Crystal clear. If someone wants to know how to use the function have to “read” this blog!!!
very nice explanation
Pingback:collapseContext and formatByExample to Convert Flat Structure to Tree Structure – Integration Learn
Very well explained!!