Page 1 of 1

XML OUTPUT Stage - Trigger Column for Grouping

Posted: Fri Mar 18, 2011 3:15 am
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.

Posted: Fri Mar 18, 2011 6:39 am
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

Posted: Fri Mar 18, 2011 7:14 am
by chulett
You actually mean a Key column for grouping, the Trigger Column option does something else entirely.

Posted: Fri Mar 18, 2011 2:16 pm
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

Posted: Fri Mar 18, 2011 2:42 pm
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.

Re: XML OUTPUT Stage - Trigger Column for Grouping

Posted: Sat Mar 19, 2011 2:02 am
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.

Posted: Sat Mar 19, 2011 6:48 am
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?