Jump to content
Changes to the Jaspersoft community edition download ×

mixed content and conditional subreports

2004 IR Help

Recommended Posts

By: uwe janner - uwejanner

mixed content and conditional subreports

2005-07-06 09:22



my source data is a list of different objects with different attributes (cat, cat, cat, dog, dog, cat, cat, mouse,...);


so i would like to automatically start a cat-subreport for the first 3 cats, then a dog-subreport for the next 2 dogs, then again a cat-subreport, and so on.

i could preprocess and rearrange the incoming data as it is necessary. but the order of the animals on the report should be as in the original list.


is this possible with jasperreports?


thx in advance for any hint,






By: C-Box - c-box

RE: mixed content and conditional subreports

2005-07-06 23:24

It's possible ... of course! :-)


Just design your three different subreports as needed for each animal(record)-type (cat, dog, mouse)...


In your MasterReport you do create first three dummygroups each with the expression "$V{REPORT_COUNT}" ...

then you place your subreport for the cats in the "DummyCatGroupHeader"... the subreport for the dog into the "DummyDogGroupHeader" ... the subreport for the mouse in the "DummyMouseGroupheader"....


then you set following printwhenexpression to your DummyCatGroupHeader: "new Boolean($F{animaltype}.equals("cat"))" to the DummyDogGroupHeader: "new Boolean($F{animaltype}.equals("dog"))" and to the

DummyMouseGroupHeader: "new Boolean($F{animaltype}.equals("mouse"))"


so the output should be as you posted want to have....


I do something similiar but with businessdata in e.g. orders with different "position-types" but I guess you just did abstract your question... so I think you also understand what I mean! :-)




Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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