Jump to content
We've recently updated our Privacy Statement, available here ×

Sub group in table component


macaxrc

Recommended Posts

Hi every body,

 

I'm use JasperStudio 5.5 and need calculate subgrups in a table.

I know that this is possible using field and detail band.

But I dont' know that this is possible in table component.

I have the follow query and result

Select a,b,mesure
from table

group by a,b

 

the result is this 

A----B----mesure

A--- C--- mesure
B--A------mesure

B----C----mesure

 

I'm need to calculate the subtotatals of A like this

A----B----mesure

A--- C--- mesure

TOTAL---""--total mesure A
B--A------mesure

B----C----mesure

TOTAL---""--total mesure B

Can you help me?

 

Thanks

 

 
Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

First of all, your SQL query will not work because "measure" column is not part of the GROUP BY clause or used in an aggregate function.

The simplest way to resolve this issue is to use the following query

Select a, b, measure from table order by a, b

then create report group "group_a" using $F{a} (column a) in the group expression. Create a variable "sum_measure" to summarize $F{measure} with reset type set to group "group_a". Now you can place this variable $V{sum_measure} in the group footer section to display total measure for column a.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...