Page 1 of 1

XML Stage Question...

Posted: Thu Jul 06, 2006 11:43 am
by kaps
I have a XML file like this...

[code]<?xml version="1.0" encoding="UTF-8"?>
<insertRow subName="XPUB_FinTrx" srcOwner="DEV1" srcName="FINANCIAL_TRANSACTION">
<col name="ID" isKey="1">
<bigint>
<afterVal>1</afterVal>
</bigint>
</col>
<col name="CCID">
<varchar>
<afterVal>DUE</afterVal>
</varchar>
</col>
<col name="AMOUNT">
<decimal>
<afterVal>56.25</afterVal>
</decimal>
</col>
<col name="CC">
<char>
<afterVal>USD</afterVal>
</char>
</col>
<col name="EXT_REF">
<varchar>
<afterVal xsi:nil="1"/>
</varchar>
</col>
</insertRow>
[/code]

I can process this XML file using Column Description of XML Input stage and get output file like this...

[code]
SubName SrcOwner SrcName Name Value
--------------------------------------------------------------------------------------
XPUB_FinTrx DEV1 FINANCIAL_TRANSACTION ID 1
XPUB_FinTrx DEV1 FINANCIAL_TRANSACTION CCID Due
XPUB_FinTrx DEV1 FINANCIAL_TRANSACTION AMOUNT 55.55
XPUB_FinTrx DEV1 FINANCIAL_TRANSACTION CC USD
XPUB_FinTrx DEV1 FINANCIAL_TRANSACTION EXT_REF 1
[/code]

But I am just wondering if there is any way I can get the output like this...

[code]
XPUB_FinTrx DEV1 FINANCIAL_TRANSACTION 1 Due 55.55 USD 1
[/code]

I would like to know if I can do this withink XML or any other ways to do it...I read some post about vertical pivots but I could not make it to work...

I appreciate your ideas...

Posted: Mon Jul 10, 2006 2:45 am
by roy
Hi,
Running those line via a transformer stage and concatenating the info, outputing it to a hashed file stage with the first part as key would result in the desired output row.
Naturally you'll also nee some stage variable to check when you changed your ID and such...

IHTH,

Posted: Mon Jul 10, 2006 8:38 am
by kaps
Roy...Thanks for your reply. I got it done using xpath of XML stage.

Posted: Mon Jul 10, 2006 9:47 am
by roy
Seems I must have missunderstood your question at that time :oops:
Glad you found the solution on your own :)
(You could have also used the folder stage, but I prefer the xpath as well)