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.useOneAsMany_MM


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:

Source Field Display Queue Information
CatID useOneAsMany_queue_CatID Total 3 context changes
total 3 values
each context contain one value
CatName useOneAsMany_queue_CatName Total 3 context changes
total 3 values
each context contain one value
Book useOneAsMany_queue_Book Total 3 context changes
total 6 values
each context contain different value count (3, 1, 2)
BookID useOneAsMany_queue_BookID Total 6 context changes
total 6 values
each context contain one value
BookName useOneAsMany_queue_BookName Total 6 context changes
total 6 values
each context contain one value

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!


useOneAsMany Explained in Easy Example
Tagged on:                 

4 thoughts on “useOneAsMany Explained in Easy Example

  • January 20, 2015 at 5:31 pm

    Beautifully explained node function useOneAsMany. Really appreciate your efforts.

    Thank You.


    • January 28, 2015 at 10:52 pm

      Hi Ajit,
      Thanks for your kind words. 🙂

      Yee Loon

  • May 19, 2015 at 5:25 am

    Really awesome and easy to understand. Thank you.

    Keep the good work.


  • August 18, 2017 at 3:45 am

    Great Explanation. Really helpful. Thank You!!


Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.