Preventing my group from being split up

Hello, first time asking a question so hopefully I'm phrasing it all right/providing the right info, etc..

 

I have a report with a few hundred rows of studies.  One of the pieces of information I have about each row (a column in the sql query) is department name.  I'd like to create groups based on department_name so that I had a report like this:

 

Cancer Department

-One cancer department study

-Another cancer department study

-Another, etc.. etc... (i.e. all o the cancer department studies)
 

Pediatric Department

-Pediatric study 1

-Pediatric Study 2

-Pediatric Study 3

-etc,etc

 

Instead I am getting 

Cancer Department

-A cancer department study

-Cancer study 2

Pediatric Department

-Pediatric study 1

Cancer Department

-Cancer study 3

Pediatric Department

-Pediatric Study 2

-Pediatric Study 3

 

 

I.e. they're being organized under their correct department, but its being broken up a bunch of times for some reason.   Any idea why?   I could provide the jasper file if helpful.

jcrozier's picture
Joined: Apr 12 2022 - 10:45am
Last seen: 1 month 4 days ago

@erikmarbad in relation to your answer, I dont see in the documentation how to prevent that grouping.  I followed the documentation in order to figure out how to group at all.  Please point me to where it discusses another way to fix this.

jcrozier - 1 month 3 weeks ago

3 Answers:

@jcrozier
>> Curious if it could have been controlled on the jasper side though

You will need to add a sort to the report.  In other report engines grouping and sorting is one transaction.  In Jasper, it is two.

 

With Sorting


 

Without Sorting


jgust's picture
2138
Joined: Jun 10 2010 - 6:39am
Last seen: 28 min 27 sec ago

Turns out I could control it on the SQL end.  If I ended the sql query with "order by department_name" it put them all together.  Curious if it could have been controlled on the jasper side though

jcrozier's picture
Joined: Apr 12 2022 - 10:45am
Last seen: 1 month 4 days ago

This problem can be solved in different ways but it will depend on how your report is made, for example, a way would be following the example offered by the documentation:

https://community.jaspersoft.com/documentation/tibco-jaspersoft-studio-u...

Although the solution of the query is useful, it is always good to know other alternatives (Generally all problems of this style are due to a bad organization of the report) because a query does not always fix the problem.

erikmarbad's picture
Joined: Feb 2 2022 - 5:31pm
Last seen: 2 weeks 5 days ago
Feedback
randomness