Grouping Report



I'm newbie to jaspersoft studio. I would like to generate a report with two group. Pass & Fail. There are three grades which are A,B, and C. I would like to group grade A & B as Pass group and C as Fail group.

How do I populate such group report?

Thank you in advanced.

claire.chanmyae's picture
Joined: Feb 26 2014 - 5:28pm
Last seen: 5 years 11 months ago

1 Answer:


supposing you can not properly fix/modify your query in order to have an additional field suitable for group creation, you could create a group based upon an expression. In there you will have something like the following ternary expression:

"A".equals($F{GRADE_VAL}) || "B".equals($F{GRADE_VAL}) ? "PASS GROUP" : "FAIL GROUP"

In this way you will end up splitting your data depending on this criteria. Graphically this will be printed out if you are able to properly order your data depending on the GRADE_VAL field.
If you are not able to do so, try to create also a variable and use the same expression. After create a sort field based upon that variable.

That's all.


P.S: you find attached two samples using the SampleDB connection. We want to group the orders in two groups: "AUSTRIA_AND_ARGENTINA" and "ALL_OTHERS". The first example exploits the fact that the data produced are already ordered (Austria and Argentina are the first countries). The second one relies on the usage of the sort field. If you notice, they have two different queries.

mrabbi's picture
Joined: Oct 31 2011 - 9:20am
Last seen: 1 hour 44 min ago