on 2011 Oct 19 9:48 PM
Hi all,
I need to create a complex mapping as follows:
Source message:
CreateOrder (0..1)
-sell-order (0..1)
--items-sell-order (0..1)
---items-sell-request (0..unbounded)
-
sell-discount (0..1)
-
sell-discount (0..unbounded)
-
discount-id (0..1)
-
discount-quantity (0..1)
-
description (0..1)
Target message:
MT_xxxx
-ORDER_V3 (0..1)
--TDESC (0..1)
---item (0..unbounded)
-
ITEM_NUMBER (0..1)
-
discount (0..unbounded)
-
REASON (0..1)
-
VALUE (0..1)
-
DESCRIPTION (0..1)
--TPLUGIN (0..1)
---item (0..unbounded)
-
ITEM_NUMBER (0..1)
-
discount (0..unbounded)
-
ID (0..1)
-
QUANTITY (0..1)
The mapping has some rules:
If sell-order - items-sell-order - items-sell-request - sell-discount - sell-discount - discount-id .length > 0 then the structure TPLUGIN must be filled
else
the structure TDESC must be filled
The problem is: the field ITEM_NUMBER is an index that is unique and must increment each record of node items-sell-request, and it is not mandatory an item to have discounts.
When I test with n items and all items with discount node, it works perfect. However, if I put for example 10 items in the source array, and for example the records 5 and 6 doesn't have discounts, the association item x discount makes the mapping get lost and mess all the target nodes.
Could anyone help me?
Thanks in advance.
Ricardo.
Hi,
Try below one.
discount---MapwithDefault---target.
BestRegards
Girii
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Girii,
Thanks for your reply. I tryed this an also change the context of sell-discount and discount-id to items-sell-request.
When I run a test and check Display Queues, they are OK. However, the result test is still messing.
The new mapping is:
items-sell-order -> TPLUGIN
items-sell-request -> item
sell-discount -> mapWithDefault(empty) -> discount
discount-id (context change to item-sell-request) -> mapWithDefault(empty) -> ID
Tks.
Hi Girii,
Thanks for your reply. I tryed this an also change the context of sell-discount and discount-id to items-sell-request.
When I run a test and check Display Queues, they are OK. However, the result test is still messing.
The new mapping is:
items-sell-order -> TPLUGIN
items-sell-request -> item
sell-discount (context change to item-sell-request) -> mapWithDefault(empty) -> discount
discount-id (context change to item-sell-request) -> mapWithDefault(empty) -> ID
Tks.
Hi.
Can you put your source and target example.. It's not clear.
As my understand you need to create index incremental if the segment have discounts.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Luis,
An example for source message could be something like:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:CreateOrder>
<ns0:sell-order>
<ns1:items-sell-order>
<ns1:items-sell-request>
<ns1:sell-discount>
<ns1:sell-discount>
<ns1:discount-id>1</ns1:discount-id>
<ns1:discount-quantity>10</ns1:discount-quantity>
<ns1:description>Description1</ns1:description>
</ns1:sell-discount>
<ns1:sell-discount>
<ns1:discount-id>2</ns1:discount-id>
<ns1:discount-quantity>20</ns1:discount-quantity>
<ns1:description>Description2</ns1:description>
</ns1:sell-discount>
</ns1:sell-discount>
</ns1:items-sell-request>
<ns1:items-sell-request>
*other fields not mentioned here, without sell-discount node*
</ns1:items-sell-request>
<ns1:items-sell-request>
<ns1:sell-discount>
<ns1:sell-discount>
<ns1:discount-id>A</ns1:discount-id>
<ns1:discount-quantity>50</ns1:discount-quantity>
<ns1:description>DescriptionA</ns1:description>
</ns1:sell-discount>
<ns1:sell-discount>
<ns1:discount-id>B</ns1:discount-id>
<ns1:discount-quantity>100</ns1:discount-quantity>
<ns1:description>DescriptionB</ns1:description>
</ns1:sell-discount>
<ns1:sell-discount>
<ns1:discount-id>C</ns1:discount-id>
<ns1:discount-quantity>200</ns1:discount-quantity>
<ns1:description>DescriptionC</ns1:description>
</ns1:sell-discount>
</ns1:sell-discount>
</ns1:items-sell-request>
<ns1:items-sell-request>
<ns1:sell-discount>
<ns1:sell-discount>
<ns1:discount-id>I</ns1:discount-id>
<ns1:discount-quantity>400</ns1:discount-quantity>
<ns1:description>DescriptionI</ns1:description>
</ns1:sell-discount>
<ns1:sell-discount>
<ns1:discount-id>II</ns1:discount-id>
<ns1:discount-quantity>500</ns1:discount-quantity>
<ns1:description>DescriptionII</ns1:description>
</ns1:sell-discount>
</ns1:sell-discount>
</ns1:items-sell-request>
</ns1:items-sell-order>
</ns0:sell-order>
</ns0:CreateOrder>
And an example for target message related to this source is:
<?xml version="1.0" encoding="UTF-8"?>
<ns2:MT_xxxx">
<ORDER_V3>
<TDESC>
<item>
<ITEM_NUMBER>4</ITEM_NUMBER>
<discount>
<REASON>I</REASON>
<VALUE>400</VALUE>
<DESCRIPTION>DescriptionI</DESCRIPTION>
</discount>
</item>
</TDESC>
<TPLUGIN>
<item>
<ITEM_NUMBER>1</ITEM_NUMBER>
<discount>
<ID>1</ID>
<QUANTITY>10</QUANTITY>
</discount>
<discount>
<ID>2</ID>
<QUANTITY>20</QUANTITY>
</discount>
</item>
<item>
<ITEM_NUMBER>3</ITEM_NUMBER>
<discount>
<ID>A</ID>
<QUANTITY>50</QUANTITY>
</discount>
<discount>
<ID>B</ID>
<QUANTITY>100</QUANTITY>
</discount>
<discount>
<ID>C</ID>
<QUANTITY>200</QUANTITY>
</discount>
</item>
</TPLUGIN>
</ORDER_V3>
</ns2:MT_GerarOrdVd_req>
Edited by: Ricardo Guedes on Oct 20, 2011 3:03 AM
User | Count |
---|---|
66 | |
10 | |
10 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.