Jump to content
Changes to the Jaspersoft community edition download ×

Summarized data with multiple rows


agoldchleger
Go to solution Solved by yama818,

Recommended Posts

Hi there,

I have data that looks like this:

AnimalClassAnimalQtyClassQty
DogMammal5080
CatMammal3080
ParrotBird2030
HummingbirdBird1030

So basically ClassQty is calculated in the database as a window function over the Class filed. I have the data above in the detail band of my report, and would like to have the animal class totals at the end of the report (I tried the summary band), such as:

ClassClassQty
Mammal80
Bird30

However, the naive approach of just placing the fields in the Summary band does not work, as I get a single row for the animal class of the last row in the detail band:

ClassClassQty
Bird30

I tried to fiddle with evaluation time properties, but to no avail. I figure that I could just stick a subreport and be done with it, but I wonder if there is a cleaner solution that I might be overlooking.

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

  • Solution

I know this is not a smart solution, but it could be accomplished by using a wrist component for the summary band.

* Preview
w20220903_preview.png.1380f62fa156f4371a7b17050112cf4e.png


* Design
w20220903_design.png.de7310fb077a146b06e741fff0e7bfb9.png

 

* SQL
To use the list component, a sub-dataset is required.
The SQL for this sub-dataset should be written as follows

select class,sum(animalqty) as classqtyfrom test.t27group by class

w20220903_previewdata.png.c797353254a97ae9eeefd3b490595f0a.png

 

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...