Jump to content

how to use Groups to get the data d


Recommended Posts


I am a newbie to jasper report. I want to generate the report as per the mock report i have attached.


data 1 title

columne1 column2 column3 column4

data            data          data         data

data            data          data         data

...                   ..........     .......              .....

.....                 ....           ......             .....

subtotal      sum         sum         sum

data 2 title

column1 column2 column3 column4

data          data         data           data

data          data         data           data

sum          sum         sum          sum

I tried using Group and i get

data 1 title

column 1 column2 column 3 column 4

data 2 title

column 1 column2 column 3 column4

detail 1

detail 2

sum          sum           sum          sum

subtotal     sum          sum          sum

I am not sure how to procede can any one please help me find a solution.











Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic


I'm actually glad to see you're designing your report like that.  Whenever I create groups, the first thing I do is make sure it's wide enough for my group description AND the column header labels, and I delete the standard column header band.  I don't like any information to come between column header labels and the data they describe, and I think it's worth an occasional repeat of those labels if it makes the report easier to read.

Two other techniques I also use every time I group that I thought I'd share with you:

1. I check the "Reprint header" box property (you'll see it if you select the group header band) and I also set the "Min height to start new page" property to 80 or something like that (enough for my 40-high group header and two detail bands of 20 high each, for example), to avoid ending a page with a new group header.

2. Where you have "Data 1 Title", I actually drag two copies of that into the group header band and have them overlap.  That may seem odd, but here's why:  first I set a "Print when expression" on each copy that is mutually exclusive and is based on the automatic count variable you get when you create a group:  I make one of them be $V{GroupName_COUNT}==0 and the other be $V{GroupName_COUNT}>0.  Now the first instance will display when I break from one group to another, while the other version will only print if I am continuing a group at the top of a subsquent page.  Now I can make them look/behave slightly differently.  I usually make the ==0 version bold and I also create a PDF bookmark for it, while the >0 version, all I do is add " (continued)" to the end of the Text Field Expression.

I use these two techniques so much with groups that it's really second nature and goes by very fast now.  Good luck!


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