IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

Generating sequential output elements Options · View
sharavanan
Posted: Friday, May 9, 2008 6:54:11 PM
Rank: Newbie

Joined: 5/9/2008
Posts: 7
We are working on to achieve a mapping where the source and target are as referred below.

Souce
=====
<Item>
<Sale>
<ItemID>000000000010000031</ItemID>
<RegularPrice>90</RegularPrice>
<Quantity>1</Quantity>
<PriceDiscount>
<Amount>5</Amount>
</PriceDiscount>
</Sale>
</Item>
<Item >
<Sale>
<ItemID>000000000010000031<ItemID>
<RegularPrice>80</RegularPrice>
<Quantity>1</Quantity>
<PriceDiscount>
<Amount>10</Amount>
<PriceDiscount>
</Sale>
</Item>

Expected Target
===============

<Batch>
<Detail>
<QTY>1</QTY>
<ITEM_ID>000000000010000031</ITEM_ID>
<UNIT_PRICE>90</UNIT_PRICE>
</Detail>
<Detail>
<QTY>0</QTY>
<UPC>000000000010000031</UPC>
<DISCOUNT_AMOUT>5</DISCOUNT_AMOUNT>
</Detail>
<Detail>
<QTY>1</QTY>
<ITEM_ID>000000000010000032</ITEM_ID>
<UNIT_PRICE>80</UNIT_PRICE>
</Detail>
<Detail>
<QTY>0</QTY>
<ITEM_ID>000000000010000032</ITEM_ID>
<DISCOUNT_AMOUNT>10</DISCOUNT_AMOUNT>
</Detail>
</Batch>


Brief explaination about the requirement is below.

1. For each <Sale> element identified in the source, a <Detail> element should be created in the target.
2. For each <PriceDiscount> identified with in a <Sale> in the source, a <Detail> element should be created in the target following the
above <Detail>.

NB: <Detail> for <PriceDiscount> can be identified by <Quantity> = 0 and <Discount_Amount>

After creating the mapping, the generated output was entirely different from that what has been expected. The <Detail> elements corresponding to
all <Sale> were populated then <Detail> for <PriceDiscount> have been populated. However, it should be sequential, ie. the <Detail> holding
the discount information should be created immediately following its relevant <Detail> corresponding to <Sale>.

Actual
======
<Batch>
<Detail>
<QTY>1</QTY>
<ITEM_ID>000000000010000031</ITEM_ID>
<UNIT_PRICE>90</UNIT_PRICE>
</Detail>
<Detail>
<ITEM_ID>000000000010000032</ITEM_ID>
<UNIT_PRICE>80</UNIT_PRICE>
</Detail>
<Detail>
<QTY>0</QTY>
<UPC>000000000010000031</UPC>
<DISCOUNT_AMOUT>5</DISCOUNT_AMOUNT>
</Detail>
<Detail>
<QTY>0</QTY>
<ITEM_ID>000000000010000032</ITEM_ID>
<DISCOUNT_AMOUNT>10</DISCOUNT_AMOUNT>
</Detail>
</Batch>
Please compare the exepected output and the actual output for more clarification. Kindly revert back for any queries on these.

Please share your experience, ideas/thoughts that may help us to achieve this mapping.
mikas
Posted: Tuesday, May 13, 2008 1:00:38 PM
Rank: Newbie

Joined: 5/13/2008
Posts: 1
Location: Vilnius
Hi,

It seems I am having similar problem with mapping from XML to EDIFACT IFTMCS message.

I have following XML:
<Changed>
<NewNo>123</NewNo>
<OldNo>321</OldNo>
</Changed>
<Changed>
<NewNo>123a</NewNo>
<OldNo>321b</OldNo>
</Changed>

I want to map this into IFTMCS segment group 35 like this:
EQD+RR+123
EQD+ZRR+321
EQD+RR+123a
EQD+ZRR+321b

But I still get following result:
EQD+RR+123
EQD+RR+123a
EQD+ZRR+321
EQD+ZRR+321b

I tried many variations of mapping with Node/Row filter, but result is still the same.
Maybe someone have dealt with similar situation? Or maybe there is a similar example in MapForce samples or tutorial?
Any help will be appreciated.

Thanks.
that
Posted: Wednesday, May 14, 2008 8:20:14 AM
Rank: Advanced Member

Joined: 6/16/2006
Posts: 502
Location: AT
sharavanan wrote:

Please share your experience, ideas/thoughts that may help us to achieve this mapping.


You'd need an additional hierarchy level in your target schema that groups the <Detail> for the item and the <Detail> for the discount. Fortunately, in this specific case, you can use the root element <Batch> for that - because MapForce knows that it may only generate one root element, it just duplicates the content if you try to create multiple root elements. So you just need to connect <Item> to <Batch>.
sharavanan
Posted: Thursday, May 15, 2008 12:16:40 PM
Rank: Newbie

Joined: 5/9/2008
Posts: 7
Hi that,

Your thought gave us an excellent hint and with that as the support, we tried with various combinations and it really worked out well.

Appreciate you for sharing your thoughts.

Great work!!! Keep it up.

Thanks,
Sharavanan
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.