on 04-23-2013 8:47 AM
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.