Jump to content
Changes to the Jaspersoft community edition download ×

Empty main report with subreports


checimovic

Recommended Posts

I have around a dozen subreports each consisting of a complex SQL query. They all work fine. I want to display them one after the other in an empty main report, which will simply act as a container for them. When I place the subreports in the detail band of the main report, they don't show up. When I put them into the column header band, they do show up (once I set the "AllSectionsNoDetail" property).

 

Is it okay to place all the subreports in the column header band? Why don't they show up in the detail band?

 

Sorry for the silly questions, but I'm pretty new to iReport.

 

Thanks,

 

Chris

Link to comment
Share on other sites

  • Replies 9
  • Created
  • Last Reply

Top Posters In This Topic

I think I figured it out...if I give the main report a bogus query (select * from sometable) and add no fields to the detail section, I can put the subreports in there and they print sequentially, without acting as detail reports. What a hack, though. It would be nice if whatever was put into the detail band of the main report would just print regardless of whether or not the detail band has a query attached to it.
Link to comment
Share on other sites

I think I figured it out...if I give the main report a bogus query (select * from sometable) and add no fields to the detail section, I can put the subreports in there and they print sequentially, without acting as detail reports. What a hack, though. It would be nice if whatever was put into the detail band of the main report would just print regardless of whether or not the detail band has a query attached to it.
Link to comment
Share on other sites

Well I guess you should think about another solution than passing a dummy query to your main report...

 

Try to create for each SubReport a DummyGroup (without an expression) and place the subreport in each Dummygroupheader-band.... so you can pass either an empty-datasource to your masterreport (if you don't need any data for it) or you pass your master-query to it (if you want to show some (meta)data).

 

Placing many Subreports in just ONE band is (as I experienced) no good solution as the remaining space calculation and the page-break logic becomes more a random game than a defined way. Sometimes Subreports overlap each other even, if you don't set float etc.....

So DummyGroupBands are much better for many subreports.

 

just my two cents

C-Box

Link to comment
Share on other sites

C-Box

 

Thank you for much for your reply in this thread. I am in the process of evaluating iReport as the reporting tool for a new application I am developing, and hit a major stumbling block in how iReport handles sub-reports. Your posting has given me the key to resolving that issue, which I had posted in another thread labeled 'Main report not properly displaying sub-reports'.

 

So far, iReport now seems to display sub-reports properly. I will continue to do tests with varying amounts of data in each of the sub-reports, but it looks good so far.

 

Once again, thank you. I really like what I see with iReport, and wanted to be able to use it for generating reports.

 

Thomas

Link to comment
Share on other sites

Thanks very much for your response. Multiple groups works well, except when I hit 10 or so groups - then the design page runs out of room, and any new groups become 0 height. If I try setting existing groups with subreports in them to have 0 height, the subreports get bumped up to the next band (for example, the column header band). Any ideas?
Link to comment
Share on other sites

What Page-Format have you set for your report (width & height)?

And what band-height do you set for your DummyGroupHeader/FooterBands.

 

If you JUST have the SubReport-Element in your DummyGroupHeader/FooterBand and no other elements.. then you can set the band height to just 1 pixel because the subreport stretches itself. The SubReport-Element is then of course also just 1 pixel.

 

So 10 groups for 10 subreports would just cause 10 pixel more space.

 

I do have up to 13 groups.... for an A4 page --> no problem!

 

hth

C-Box

Link to comment
Share on other sites

Thanks for the good advice. I was able to get the band heights down to 5 without the subreports getting moved around. However, this required really careful placement with the mouse. How did you get the band heights down to 1? When I set the band properties, the subreport gets moved. Is there some way to add subreports to group bands without having to drag and drop?
Link to comment
Share on other sites

Of course it's possible and quite easy

 

I do use iReport 1.26 for designing reports.

here you go:

 

select your subreport element

open the properties dialog via doubleclick

set the height to 1 pixel

set the related band in the upper combobox

set the position "top" to 0

open the band properties dialog

set the band height to 1 pixel

 

[/ol]

 

voilá that's it;)

 

you can also move the elements with the keyboard (arrow keys)

 

hth

C-Box

Link to comment
Share on other sites

Ha, thank you - I did all that, but I was forgetting to set the Top property in the subreport to 0! Now it works.

 

Okay, now I have to figure out how to generate a table of contents ;) You've been very helpful so far, but if you feel like typing some more, please feel free to share some pointers on setting up a nice toc.

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