To repeat a target field in message mapping, we can use one-to-one mapping, CopyValue, Graphical Variable and useOneAsMany.

Example 1: –

Let’s try one-to-one mapping and CopyValue in below example. Both one-to-one mapping and CopyValue fail to produce correct result.

A1.png

A2.png

Using Graphical Variable / useOneAsMany, produces correct result.

A3.png

A4.png

Example 2:-

Using Graphical Variable will not produce correct result, in below example. Using useOneAsMany, produces correct result.

A5.png

A6.png

So, how to choose between Graphical Variable and useOneAsMany?

If input hierarchy is maintained in output, choose Graphical Variable. If input hierarchy is becoming flat in output, choose useOneAsMany. FYI, Graphical Variable is simple and efficient at runtime (Link page 8).

Below diagram guides on, choosing between Graphical Variable and useOneAsMany.

A7.png

FYI. How to use Graphical Variable (slide 9 in this demo). Variables in the Target Structure. useOneAsMany. copyValue.

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

  1. Eng Swee Yeoh

    Raghu,

    Nice effort on the comparison between the different mapping approaches. In particular, I have seen copyValue being suggested incorrectly for one-to-many scenarios. copyValue’s intended functionality is to select a specific position from a recurring source field. It’s by sheer coincidence that it sometimes works because it has a side effect of generating multiple occurrences in the target field. Hopefully this article will debunk the incorrect usage of copyValue 😉

    Personally, for such one-to-many scenarios, wherever possible my preference is useOneAsMany over graphical variable. The main reason is because the “display queue” functionality does not work correctly on a mapping that has a variable as one of its source fields. Therefore, it can only be tested via the Test tab functionality, but for complex mapping logic, knowing the queue values at each step of the mapping comes in very handing during troubleshooting.

    Thanks again for the effort. 😉

    Rgds

    Eng Swee

    (0) 

Leave a Reply