Jump to content
Changes to the Jaspersoft community edition download ×

How to use SubReports on different conditions

2004 IR Help

Recommended Posts

By: C-Box - c-box

How to use SubReports on different conditions

2004-04-15 08:50



I do have a MainReport that should show some so called "HEAD"-data... and also some so called "POSITION"-data.

Therefore I do use a subreport in the detailband of the MainReport... but now the problem:

Some position should appear in a different design dependent on a certain vaule of a position-datafield.

Therefore I created a new SubReport (MainSubReport) that contains for each possible value of my dependet-datafield a new SubReport (SubReport1, SubReport2,...)

I put them in the designer (iReport 0.2.3) at the same position in the TitleBand of the MainSubReport.

The MainReport just contains the MainSubReport in its detailband.

The DataSourceConnection is realized with parameters from the MainReport to the MainSubReport and then the same parameter is given to every SubReport[N] (SubReport1,SubReport2,....)


But when I drive the MainReport now after I compiled all SubReports successfully there always comes the SubReport for the first Position value and all the following positions are shown with that subReport (so a Position with value =2 shows just the fields&design that are used in SubReport1 but should actually show the fields&design from SubReport2).


What I'm doing wrong???? Is there another possibility?


Very complicated to explain... I hope anybode could at least understand a bit of it?!?!?








By: C-Box - c-box

RE: How to use SubReports on different conditions

2004-04-20 23:12

Hi again,


I solved the problem...


it was the wrong query in all the subreports.. I used the same for the MainSubReport and for all SubReports[n]...


Correctly it must be a query that just gives one entity from the datasource back - so now I pass the unique primary key to all the subreports that just one entity will be in the resultset.


and voilá­ now it works like I wanted.



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