Page 1 of 1

XML Grouping In Header Detail Relation

Posted: Tue Jan 23, 2007 1:35 pm
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

Posted: Tue Jan 23, 2007 11:40 pm
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.

XML Deatil Grouping

Posted: Wed Jan 24, 2007 12:48 pm
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