cancel
Showing results for 
Search instead for 
Did you mean: 

Help with Mapping

Former Member
0 Kudos

Hi XI experts:

I have a mapping question. This is the TLOG message coming from a POS into XI and needs to be mapped to the target.

There are 2 types of nodes DTL (Detail) and DDC (Discount). They both have a common element DETAILNR. See the xml below.

I need to take the QUANTITYSOLD field from the DTL node and multiply with the AMOUNT field of the DDC node and pass the result for matching DETAILNR and map to a field at the target side.

The DTL and DDC nodes are at the same level, but the number of DTL nodes is more than that of the DDC node.

Your help will be appreciated,<removed by moderator>

Thank you.

<DTL>

<RECORDTYPE>DTL</RECORDTYPE>

<DETAILNR>0065</DETAILNR>

<QUANTITYSOLD>+0010</QUANTITYSOLD>

</DTL>

<DDC>

<RECORDTYPE>DDC</RECORDTYPE>

<DETAILNR>0065</DETAILNR>

<AMOUNT>+00000000.89</AMOUNT>

</DDC>

Edited by: Mike Pokraka on Jul 24, 2008 1:16 PM

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

>>but the number of DTL nodes is more than that of the DDC node.

You can use collapseContext before you multiple fields,it will basically insert null values if some fields are less or missing.

after collapseContext, just implement your mapping logic,it will multiple corresponding values from DTL and DDC.

Thanx

Aamir

Edited by: Aamir Suhail on Jul 23, 2008 4:17 PM

Former Member
0 Kudos

I forgot to mention that not every DTL segment has a DDC segment. Could you also specify what goes in the UDF?

Thank you.

Former Member
0 Kudos

Can you post a proper XML input with couple of DTL and DDC segments and the expected XML output. This will give us a clear idea on occurence.

BR

Former Member
0 Kudos

Sameer,

The XML is:

Thank you.

<ns:MT_TLOG xmlns:ns="urn:nslc:xi:BeanStore:POSI001:Tlog">

<RecordSet>

<HDR>

<RECORDTYPE>HDR</RECORDTYPE>

<STORECODE>2367</STORECODE>

<TRADINGDATE>20080719</TRADINGDATE>

<TRANSACTIONTYPE>003</TRANSACTIONTYPE>

<TILLID>003</TILLID>

</HDR>

<DTL>

<RECORDTYPE>DTL</RECORDTYPE>

<DETAILNR>0013</DETAILNR>

<SKUCODE>00000000000001000893</SKUCODE>

<QUANTITYSOLD>+0001</QUANTITYSOLD>

</DTL>

<DTL>

<RECORDTYPE>DTL</RECORDTYPE>

<STORECODE>2367</STORECODE>

<SKUCODE>00000000000001001939</SKUCODE>

<QUANTITYSOLD>+0010</QUANTITYSOLD>

</DTL>

<DTL>

<RECORDTYPE>DTL</RECORDTYPE>

<STORECODE>2367</STORECODE>

<SKUCODE>00000000000001001493</SKUCODE>

<QUANTITYSOLD>+0010</QUANTITYSOLD>

</DTL>

<DTL>

<RECORDTYPE>DTL</RECORDTYPE>

<STORECODE>2367</STORECODE>

<SKUCODE>00000000000001001493</SKUCODE>

<QUANTITYSOLD>+0010</QUANTITYSOLD>

</DTL>

<DDC>

<RECORDTYPE>DDC</RECORDTYPE>

<DETAILNR>0075</DETAILNR>

<AMOUNT>+00000000.89</AMOUNT>

</DDC>

<DDC>

<RECORDTYPE>DDC</RECORDTYPE>

<DETAILNR>0065</DETAILNR>

<AMOUNT>+00000000.89</AMOUNT>

</DDC>

<TAX>

<RECORDTYPE>TAX</RECORDTYPE>

<STORECODE>2367</STORECODE>

<TILLID>003</TILLID>

<TRANSACTIONNR>00018947</TRANSACTIONNR>

<TAXNR>0001</TAXNR>

<TAXMETHOD>01</TAXMETHOD>

<AMOUNT>+00000734.97</AMOUNT>

</TAX>

</RecordSet>

</ns:MT_TLOG>

Former Member
0 Kudos

Hi,

Are DTL and DDC nodes are sorted on DETAILNR?

If yes, you can use DTL/DDC --> removecontext --> split by value on value changed --> user defined function to pass 2 contexts DTL, DDC and multiply all DTL values with DDC --> splil by value ---> target field

Thanks,

Beena.

Former Member
0 Kudos

Beena,

Thank you for your quick response.

The nodes are not sorted.

Former Member
0 Kudos

Hi,

Use SortByKey to sort the amount and quantity where key will be DETLNR.

DETLNR (remove context) and Amount (remove context)---> sort by key --> split by value on value change

DETLNR (remove context) and quantity (remove context) ---> sort by key --> split by value on value change

Pass these two to user defined function and multiply.

Thanks,

Beena.