Skip to Content
Author's profile photo Raghu Vamseedhar Reddy Kadipi Reddy

Choosing between Graphical Variable and useOneAsMany

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.



Using Graphical Variable / useOneAsMany, produces correct result.



Example 2:-

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



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.


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

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Eng Swee Yeoh
      Eng Swee Yeoh


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


      Eng Swee