Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Adding column to a dataset programtically
sandarenu
Hi everyone,
I'm having some trouble developing report for following situation.
I have a database containing transaction details. It contains both credit and debit transactions. Fields I've are userId, dateTime, trxId, amount, trxType
In the transaction report for a user I've to show all the transactions(both credit & debit), but have to show them in two different columns. Report should look like follows.
TrxId | Credit | Debit
1 | 100 |
2 | | 500
Total |100 | 500
I was thinking of updating the dataset programatically and add two new columns credit and debit. But I don't know how to do that. I tried to use DataSourceEventAdapter.onFetch, but it do not support add new column to the data set.
I'm using JDBC data source here.
Can anyone help me on this...
Thanks in advance,
Regards,
Sandarenu.
Find more posts tagged with
Comments
rawesso
Hi,<br />
<br />
I assumed that debits are negative values and credits positive values. Attached is a small example where the data source is a flat file containing a column amount. In the report, I create two computed columns and in their expression builder, I test if the value is negative or positive before filling the field. I hope this helps.<br />
<br />
Thanks,<br />
<br />
<br />
<br />
<br />
<blockquote class='ipsBlockquote' data-author="'sandarenu'" data-cid="104930" data-time="1340189757" data-date="20 June 2012 - 03:55 AM"><p>
Hi everyone,<br />
I'm having some trouble developing report for following situation. <br />
I have a database containing transaction details. It contains both credit and debit transactions. Fields I've are userId, dateTime, trxId, amount, trxType<br />
<br />
In the transaction report for a user I've to show all the transactions(both credit & debit), but have to show them in two different columns. Report should look like follows.<br />
<br />
TrxId | Credit | Debit<br />
1 | 100 |<br />
2 | | 500<br />
<br />
Total |100 | 500<br />
<br />
I was thinking of updating the dataset programatically and add two new columns credit and debit. But I don't know how to do that. I tried to use DataSourceEventAdapter.onFetch, but it do not support add new column to the data set. <br />
I'm using JDBC data source here.<br />
<br />
Can anyone help me on this...<br />
<br />
Thanks in advance,<br />
Regards,<br />
Sandarenu.<br /></p></blockquote>
bgbaird
I routinely do this as a computed column in the dataset.
Just make a new computed column in the dataset editor, then using the expression builder, do what you wish.
Here is an example:
Brian
sandarenu
Thanks everyone...
I managed to get it working using computed columns as you have advised.
Regards,
Sandarenu.