cancel
Showing results for 
Search instead for 
Did you mean: 

How to add an extra row at the end of the Grid?

HariCS23
Contributor
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

prasanna_vittal
Participant
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

The cleanest way to have both the detail and summary results is to use the Crosstab action in BLS.

Rick

HariCS23
Contributor
0 Kudos

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

Former Member
0 Kudos

Crosstab will do exactly what you desire. It does not create any "new" columns, but instead, provides new "rows" with subtotals and overall totals.