Previous post useOneAsMany explained in easy example used an example to convert tree structure into flat structure by using useOneAsMany. This post will do the reverse, convert flat structure back to tree structure. The source message type is flat structure.
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
mapWithDefault is useful to handle those cases where the source message field is expected, but might not be existed. Example in previous firstname lastname to fullname example, both firstname and lastname is expected to be concatenated. Before implement mapWithDefault: