XML OUTPUT Stage - Trigger Column for Grouping

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
harish_s_ampeo
Participant
Posts: 26
Joined: Tue Dec 18, 2007 6:31 am

XML OUTPUT Stage - Trigger Column for Grouping

Post by harish_s_ampeo »

I am generating an XML file. The requirement is when Prdname and ccy col changes we need to have <accounts> tag opened and closed for new combination. So in order to achieve this if I am giving the trigger column as prdname, then i am getting the following output:

<accounts>
<datarow>
<prdcode>CABIP</prdcode>
<prdname>CR ACCOUNT-SPC</prdname>
<acctnum>0712030100010001</acctnum>
<ccy>IDR<ccy>
</datarow>
<datarow>
<prdcode>CABIP</prdcode>
<prdname>TEST PRODUCT NAME</prdname>
<acctnum>0712030100010001</acctnum>
<ccy>IDR<ccy>
</datarow>
</accounts>

There is only option of selecting only one column as Trigger column in XmlOutput stage. So i created a dummy column and contanenated prd_name and ccy columns and used this dummy column as trigger columns. Now the tags and output format is coming as expected. But the dummy column data is also being traversed to the output xm file.

<accounts>
<datarow>
<prdcode>CABIP</prdcode>
<prdname>CR ACCOUNT-SPC</prdname>
<acctnum>0712030100010001</acctnum>
<ccy>IDR<ccy>
<dummy>CR ACCOUNT-SPC~IDR</dummy>
</datarow>
</accounts>
<accounts>
<datarow>
<prdcode>CABIP</prdcode>
<prdname>TEST PRODUCT NAME</prdname>
<acctnum>0712030100010001</acctnum>
<ccy>IDR<ccy>
<dummy>TEST PRODUCT NAME~IDR</dummy>
</datarow>
</accounts>

So now in the above xml the tags - dummy tag needs to be removed as it was used for grouping.

Expected output :

<accounts>
<datarow>
<prdcode>CABIP</prdcode>
<prdname>CR ACCOUNT-SPC</prdname>
<acctnum>0712030100010001</acctnum>
<ccy>IDR<ccy>
</datarow>
</accounts>
<accounts>
<datarow>
<prdcode>CABIP</prdcode>
<prdname>TEST PRODUCT NAME</prdname>
<acctnum>0712030100010001</acctnum>
<ccy>IDR<ccy>
</datarow>
</accounts>

Please can you let me know what needs to be done to achieve the desired output.
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Check the Description property of that column in the input link. Make sure it doesn't have any "/--anything" in it. The slash dictates that the stage should apply xpath to that column.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You actually mean a Key column for grouping, the Trigger Column option does something else entirely.
-craig

"You can never have too many knives" -- Logan Nine Fingers
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Not sure what harish_ means then ....I might have misunderstood...I thought that a trigger column was created, and in fact, is working, but now is appearing in the xml. But I might have mis-read it.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

No, pretty sure you got everything right in noting the fact that they need to esure the 'trigger column' has no XPath Expression so it is not included in the output XML. Me, I was just trying to point out that the actual Trigger Column option is what controls when the output filename changes, in case anyone mixed the two up.
-craig

"You can never have too many knives" -- Logan Nine Fingers
harish_s_ampeo
Participant
Posts: 26
Joined: Tue Dec 18, 2007 6:31 am

Re: XML OUTPUT Stage - Trigger Column for Grouping

Post by harish_s_ampeo »

Hi Guys,

I need to group the xml tags based on prdname and ccy columns. I tested by giving the trigger column - prdname. The accounts tag will be closed and new tag is opened only when the prdname changes. If the prdname is same for the next record the data will be in the same accounts tag.

Now my requirement is i need to group based on 2 columns -prdname anc ccy columns- when anyone changes i need to open a new accounts tag.

Since there is option of selecting only one column as trigger column, I created a dummy column in transformer and i concatenated the prdname and ccy columns and used this dummy column as trigger column in xml output stage.

Actually now that my grouping is coming accordingly as expected. But I am getting the additional dummy tag inside the xml, which i have used for grouping.
So I need to remove the tag <dummy>...</dummy> from my xml.

The tags will be repeating for every data. I hope I have conveyed my problem to you guys. Please let me know in case u need more info on this. Thanks for ur interest on this post.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Well... ok... pretty sure we followed all that. How about Ernie's piece of advice? What XPath Expression does your 'dummy' column have? Does it still work if you leave it empty as has been suggested?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply