cancel
Showing results for 
Search instead for 
Did you mean: 

PI Mapping : Merge data from difference node into 1 node

Former Member
0 Kudos

Dear Expert,

          I have problem to merge data from difference node into one like below example.

          Source :

          <Order>

               <DoneOrder>

                         <Product>Mat1</Product>

               </DoneOrder>

               <DoneOrder>

                         <Product>Mat2</Product>

               </DoneOrder>

               <PendingOrder>

                    <Produce>

                         <Produce>Mat3</Produce>

                    <Produce>

                    <Produce>

                         <Produce>Mat4</Produce>

                    <Produce>

               </PendingOrder>

          </Order>

          Target :

          <Root>

               <AllOrder>

                    <rows>

                         <Product>Mat1</Product>

                    </rows>

                    <rows>

                         <Product>Mat2</Product>

                    </rows>

                    <rows>

                         <Product>Mat3</Product>

                    </rows>

                    <rows>

                         <Product>Mat4</Product>

                    </rows>

               <AllOrder>

          </Root>

          Could you please suggest the solution for this transformation this message? (It will be good if not use UDF)

          Thank you very much!!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

you can acheive it by below map

Result:

siddhardha_dnk
Active Participant
0 Kudos

Hi Sujit,

In this case, materials in DoneOrder(Mat1, Mat2) and also materials in PendingOrder(Mat3, Mat4) should get populated in the target side.

If we map DoneOrder to rows, what about the PendingOrder. Hope it wont provide desired output(if I am right). If you have any other logic, Please post the same.

Regards,

DNK Siddhardha.

Former Member
0 Kudos

>>>> If we map DoneOrder to rows, what about the PendingOrder.

PendingOrder is mapped to the duplicated rows[1]. Hope I have answered your query.

Thanks,

Answers (4)

Answers (4)

siddhardha_dnk
Active Participant
0 Kudos

HI Songphon,

Please follow the mapping for your requirement.

Note: I am unable to understand that why you are using same "Produce" node as Root node and also Element node under "PendingOrder" in your payload.

Right Click on rows node and select Duplicate Subtree.

Map the original "rows" node to Done_Order and original "Product"(Target) node to "Product"(Source) node.

Map the duplicate "rows" node to Produce_1(in your payload, Produce(Root node)) and Duplicate Product(Target) to Produce_2(in your payload, Produce (Element Node)).

Mapping:


Result:

In case you are using "Produce" node as Element node without "Produce" as Root node, you need to map Pending_Order to duplicate "rows"(Target) node.

Regards,

DNK Siddhardha.

Former Member
0 Kudos

DNK,

I have suggested the same logic and the same way of mapping to Songphon.

We have duplicated the row node and only then we can perform the mapping and same has been shared in the screenshot ( above in my comments.)

Would request you to pls check.

Thanks,

Sujit

siddhardha_dnk
Active Participant
0 Kudos

Hi Sujit,

I didn't see the mapping for duplicate node in screens. So, queried and replied again. Anyways thanks for your reply and sharing your knowledge.

Regards,

DNK Siddhardha.

Former Member
0 Kudos

Dear All,

          Thank you very much for your suggestion

Songphon L.

Former Member
0 Kudos

Hi

Please use XSLT mapping for this kind of requirement. Graphical mapping can be clumsy so best to go for XSLT mapping.

former_member184789
Active Contributor
0 Kudos

Hi,

In your case, you are having two types of source segments as 'Done Order' & 'Pending Order'. If your requirement is such that first you have to populate target segment 'rows' corresponding to 'Done Order-Product' first & then  according to 'Pending Order-Produce'. You can create a duplicate subtree of the target segment 'rows', so now you have two segments as 'rows'. Map the first with 'Done Order' & map the field Product(Source) to Product(target). Now map the second subtree of 'rows' with 'Pending Order' & map the field Product with Produce.