Hello,
I have the following scenario: (Input Doc)
Orders
Id
Name
Type
Items
ID
Name
Qty
I need to map this to a data structure of following
Orders
ID
Name
Type
ListofItems
Items
ID
Name
Qty
I can map at the order level only. How do I map the items where the structure is different? Currently only the first record gets mapped. Others are not there?
I believe both your input/output are documentlists.
If the structure of the document varies then instead of specifying the Loop on in-array and out-array, just set the Loop/in-array and inside the loop map the corresponding data to a temporary output document and invoke the appendToDocumentList (original output document).
If this doesn’t work,please tell us the process that you are currently doing.
In the output document what ever the records represents doclist,create a temp_doc for (Orders,Items)and use the appendToDocumentList and map the corresponding temp document to the original doclist.
example:
Loop on in-array (Orders)
create orders_temp document
–>ID (field)
–>Name (field)
–>Type (field)
–> ListofItems(doc)
----->Items (doc list)
----->ID (field)
----->Name(field)
----->Qty (field)
in the Orders/ListofItems/Items mapping the create another child loop on in-array (Items)
create a temp_Items document
------ID (field)
----->Name(field)
----->Qty (field)
When Items mapping is done append this temp_Items to temp_orders/ListofItems/Items (doclist)
finally append temp_orders to HICDM/Orders original (doclist)
Hello RMG,
Here is what I did:
Loop on /Orders
–> Map Orders field to orders_temp doc
–> Append to Doc? (what params do I provide for fromList and toList)
–> Loop on Orders/Items
------->Map Items field to item_temp doc
-------> Append to Doc? (what params do I provide for this?)
Loop on /Orders
–> Map Orders field to orders_temp doc
–> Append to Doc? (what params do I provide for fromList and toList)
you should create orders_temp as a document not as doclist and map the Orders elements initially
Before Appending the orders_temp to Orders you have to map the Orders/Items.So
–> Loop on Orders/Items
------->Map Items field to item_temp doc
-------> Append to Doc? (what params do I provide for this?)
you should create item_temp as a document not as doclist
then in Appending service pass the params for fromItem (item_temp) and toList (orders_temp/ListofItems/Items) and remember dropping the item_temp in the pipelineout.
Finally in Orders Appending pass the params for fromItem (orders_temp) and toList (Orders) and remember dropping the orders_temp in the pipelineout.
After Comming out of the loop you will see the correct output document that you require.