on 02-13-2008 4:46 AM
Hi gurus,
I am getting result from the select query which has 4 columns.
I got the requirement to display the sum of those columns as the last row.
How can i add the another row at the end of the iGrid ?
Data would look like
Sno Col1 Col2 Col3 Col4
1 4 6 1 6
2 5 8 0 8
3 6 1 2 5
Sum 15 14 3 19
Do i have to add transformation to the sql query? or
Can i add row to the display tempalate by accessing the Gridobject?
Please help.
Thanks
Vansi
Edited by: vamsi P on Feb 12, 2008 8:49 PM
Edited by: vamsi P on Feb 12, 2008 8:49 PM
Vamsi,
One of the ways to achieve this is to use "Add Row" action block in the transaction. You can then have an assignment block to calculate the sum. And then using an xacute query and a grid template, you can show the required output.
Prasanna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vamsi,
There are a few options ...
1) The one suggested by Prasanna
2) Loop through all rows via JavaScript and use the GridObject methods to set cell values and then perform an applet.refreshGrid( false )
3) Apply an Inline transform
4) Use a stored procedure to return the results and the totals as one recordset.
The stored procedure would be the fastest for runtime.
The Iniline XSL transform would be the second fastest. If you specify the XSL in a generic way, you may even be able to reuse it in other scenarios. If you hardcode the fields in the XSL, it would be a matter of simple code adjustment when you encounter a similar scenario.
Hope this helps.
Cheers,
Jai.
Hi Rick,
Thanks for the reply.
I read the documentation of cross tab.
If i understood correctly, This would give us new column values ( for numberic ) based on the grouped column value.
But i need a new row which should give me sum of each coulumn.
Can i acheive the above with cross tab??
Thanks
Vansi
User | Count |
---|---|
11 | |
6 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.