Mapping Nested Arrays

Before you map a nested array, you must map its parent root. Scoping variable is particularly useful when mapping the child elements in nested arrays.

Here is an example of nested array where Address is a nested array whose parent is Customer:

To map Address, do the following:

Procedure

  1. Map its parent, Customer. When you map Customer, you automatically set the scope of Customer.

    In the image above, Customer is mapped to Customer1. The first argument, $flow.Customer1 is the source array (from which Customer gets the data) that you are mapping to. This defines the scope (boundary) in the Upstream Output within which you can map Customer. So, this is the scope of Customer. The second argument, "Customer", is the scoping variable given to this scope - the loop here refers to the iteration of Customer. By default, the scoping variable has the same name as the loop for which the scope is being defined (in this case Customer). You can edit the scoping variable to any string that might be more meaningful to you. This is equivalent to saying that mapping of a child element of Customer can happen only to children of Customer1 in Upstream Output.

  2. Map Address. Now the scope of Address gets defined.

    Notice that the mapping for Address:

    • contains the parent scope as well. The parent scope is referred to by its scoping variable, "Customer". Remember that the scope of Customer was set when you mapped Customer to Customer1 in the first step above, so we can now simply refer to the parent scope by its scoping variable, "Customer".
    • $loop["Customer"] refers to the iteration of the Customer1 array. $loop represents the memory address of the Customer1 (the scope for Customer) in Upstream Output.

    • $loop["Customer"].Address1 is the scope of Address. This scope is denoted by the scoping variable "Address", which is the second variable in this mapping. Since Address is a nested array of Customer, when you map to Address or its child elements, its mapping includes the scope of Customer as well.