XML Grouping In Header Detail Relation

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
seethamsetty
Participant
Posts: 24
Joined: Sun Nov 13, 2005 6:14 pm

XML Grouping In Header Detail Relation

Post by seethamsetty »

Hello!,

I am reading xml file , transforming it and writhing as xml file using xml out stage.

Sample xml out file is given below.

Job looks something like this:

Folder stage - Xml Input - Transformer - Xml Outstage.

Requirment is to generate header & detail relationship .
by eliminating the duplicate enteries for the same record.

Did any one try to solve this type of problem.

<?xml version="1.0" encoding="UTF-8"?>
<!--
- Generated by Ascential Software Corporation, DataStage - XMLOutput stage -
- Tue Jan 23 10:42:02 2007
-->
<RadiantDocument>
<SupplierData SupplierEDINumber="425" SupplierName="MCLANE COMPANY"></SupplierData>
<CreditMemoList>
<CreditMemo CreditMemoNumber="0506278754" CreditMemoDate="2006-09-29">
<BusinessUnitData BusinessUnitEDINumber="425" BusinessUnitName="MCLANE COMPANY"></BusinessUnitData>
<ItemList>
<Item ProductCode="434894" Quantity="-2" CreditAmount="-10.66"></Item>
</ItemList>
<CreditItemSubtotal>
-22.3
</CreditItemSubtotal>
<DeliveryChargeCredit>
2.48
</DeliveryChargeCredit>
<CreditTotal>
-22.3
</CreditTotal>
</CreditMemo>
<CreditMemo CreditMemoNumber="0506278754" CreditMemoDate="2006-09-29">
<BusinessUnitData BusinessUnitEDINumber="425" BusinessUnitName="MCLANE COMPANY"></BusinessUnitData>
<ItemList>
<Item ProductCode="674069" Quantity="-2" CreditAmount="-14.12"></Item>
</ItemList>
<CreditItemSubtotal>
-22.3
</CreditItemSubtotal>
<DeliveryChargeCredit>
2.48
</DeliveryChargeCredit>
<CreditTotal>
-22.3
</CreditTotal>
</CreditMemo>
</CreditMemoList>
</RadiantDocument>

Thanks in advance
seethamsetty
Kirtikumar
Participant
Posts: 437
Joined: Fri Oct 15, 2004 6:13 am
Location: Pune, India

Post by Kirtikumar »

Following XPaths should be used to generate this XML.

Code: Select all

/RadiantDocument/SupplierData/@SupplierEDINumber
/RadiantDocument/SupplierData/@SupplierName
/RadiantDocument/CreditMemoList/CreditMemo/@CreditMemoNumber
so on...
Define one empty column Item ProductCode as key column with XPath as /RadiantDocument/CreditMemoList/CreditMemo/ItemList/.

I have not tested this but it should work looking at the XML.
One more thing - when you add something in the post which should look formatted, it is better to put it in code tags. It makes easier for others to understand.
Regards,
S. Kirtikumar.
seethamsetty
Participant
Posts: 24
Joined: Sun Nov 13, 2005 6:14 pm

XML Deatil Grouping

Post by seethamsetty »

I have added an empty field with the xpath in the xmloutput
but it does 'nt work.

If we hav 2 records in a generate xml file for the same invoice.

Header and summary should not repeat for the second record .

Thanks
seethamsetty
Post Reply