cancel
Showing results for 
Search instead for 
Did you mean: 

UDF to compare queues at runtime

Former Member
0 Kudos

hi Experts,

I have a mapping requirement as below.

could anyone help me on this?

<data>

  <POnumber> 11111</POnumber>

<deliverynumber> 12345</deliverynumber>

<statuscode> 001</statuscode>

<productid> TV</productid>

<quantity> 23</quantity>

</data>

<data>

  <POnumber> 11111</POnumber>

<deliverynumber> 12345</deliverynumber>

<statuscode> 001</statuscode>

<productid> Mobile</productid>

<quantity> 50</quantity>

</data>

<data>

  <POnumber> 23423</POnumber>

<deliverynumber> 234242</deliverynumber>

<statuscode> 005</statuscode>

<productid> dvd</productid>

<quantity> 10</quantity>

</data>

..

the output should be like this:

<data>

  <POnumber> 11111</POnumber>

<deliverynumber> 12345</deliverynumber>

<statuscode> 001</statuscode>

<product>

<id>TV</id>

<quantity>23</quantity>

</product>

<product>

<id>Mobile</id>

<quantity>50</quantity>

</product>

</data>

<data>

  <POnumber> 23423</POnumber>

<deliverynumber>234242</deliverynumber>

<statuscode> 005</statuscode>

<product>

<id>dvd</id>

<quantity>10</quantity>

</product>

</data>

I have to group the fields producdid and quantity  under product node, if all other fields(ponumber, deliverynumber,statuscode) are same in the XML. could anyone guide me on this?

Thanks,

Indira D

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Indira,

Can you please try the below mapping. It works fine.

Regards,

Malini

sahithi_moparthi
Contributor
0 Kudos

Hi Indira,

   You can acheive this by using graphical mapping.Please find the belwo screenshot.

Please check and let me know if you are facing any issue

ambrish_mishra
Active Contributor
0 Kudos

Hi Indira,

You should be able to achieve this by graphical mapping. you can concatenate the PONumber, DeliveryNumber and Statuscode (One higher context than data) and use SplitByValue (Value Change) to come up with target structure. Assumption is the data is coming "Grouped By" these 3 fields from source. Else you can use a simple XSLT to group the data and then do a graphical mapping like I suggested above.

Hope it helps.

Ambrish

JaySchwendemann
Active Contributor
0 Kudos

Indira,

seems you don't need to sum any of your quantities and such, so you just might be good to go with XSLT mapping. PI doesn't fully support XSLT 2.0 so any advanced operation like summation are not possible yet but for your situation XSLT looks just fine.

Have a look at <xsl:template match="..."> and <xsl:apply-templates select=""> There's a ton of help over there in stack overflow.

Please come back if you need more information.

Cheers

Jens

allamudi_loordh
Active Participant
0 Kudos

Hi indira,

Take this way logic and think of coding..

Take first context as base for comparison with remaining all context.if the above fields are matching in the other context that time make result.addvalue().  Now after completing comparision with all ..start taking 2nd context and compare with 3,4,,etc.. by this way.. you can do..

what is your end to end scenario..if it is file to file we can go ahead with java mapping.

let me know..

Regards,

Loordh.