Subreport with multiple pages breaks pagination - jasper-reports

I am using Jaspersoft Report to compile a report that consists of a multitude of subreports.
They all have 1 Title and 1 Detail Band.
I manage to fit most of them onto one page, so up until now it was enough to put them in the Main Reports Detail/Summary Section, put a Page-Break underneath and put the next one there.
But since my Objects should be visible when working with the file, I inevitably ran out of space on the first Detail-Band of my Main Report, and added another.
The first subreport in the new Detail Band contains a list, the size of which I have no control over, since it's not a chart, the object I usually work with. So it now spans ~ 2 1/4 page.
I put it in the main Report, it creates it's own page just fine (starts on the page after the subreport before it ended) but when I put a page break afterwards, and add my new Subreport below, what happens is that the title of the new subreport is printed right into the 2nd page of the List, while the Detail of the new Report is printed on the page after that.
So Basically:
Design:
Break
Subreport 3 Pages
Break
Subreport 1 Page
Preview:
Break
Subreport
Page 1
Page 2 Title of the next Subreport overlapping the List
Page 3 Details of the next Report overlapping the list
Page 4 Empty Page

The brute force approach of "just put the newer Subreport onto a new Detail-Band solved the issue. Still would be nice to know a less dirty method.

Related

my table jasper report repeat the data many time [duplicate]

I am new to JasperReports, basically I want to put a subreport in a mainreport
The problem is that I put the sub report in the Detail band, so when I query a database that has multiple data the subreport will always repeat itself multiple times when I output the report to a pdf. I want a report that does not repeat itself regardless of how many data I have in the database that i connect with
I have searched the Internet and the solutions is to add
new Boolean($V{REPORT_COUNT}.intValue()==1)
in the print when expression attribute of the subreport, that does solve a part of my problem due to the fact that now my subreport only prints once but it still leaves some blank pages after my subreport is displayed
So I assume it is still repeating itself but just doesn't print the data because of the expression that I added , people say that the nature of the detail band is supposed to work that way and that I shouldn't put the subreport in the detail band, but if I put it in some other band I get this error:
Error filling print... Subreport overflowed on a band that does not support overflow.
The error above will happen if I have a lot of data to the extent that it may take up more than a page.
How do remove those blank pages? If I am ask to not put it in a detail band then what should I do? or what solution are there?
The Detail band will be generated as many times as the number of records you have in your main dataSet(populated by the top-level query).
If you want to keep the subreport in the Detail band, which is normal by the way, you can do one of these things:
either have a dummy query that returns only one record, so that the Detail band generates only once. Then, pass the report connection to your subreport. You may have done that already. This way you can run your query independently of the main report.
or leave the report as-is and add your printWhen expression ($V{REPORT_COUNT}.intValue()==1) directly on the Detail band, not on the subreport. Please note that this is just an ugly hack that may affect the report performance. Your main query still returns a lot of data that you don't use so you should consider the other options.
If you can move the subreport out of the Detail band, place it in a band that allows overflow like Title or Summary band. Then:
have your main dataSet's query empty so that no Detail band gets generated
set whenNoDataType="AllSectionsNoDetail" at the report level(in the <jasperReport> tag) so that all the other sections except the Detail get generated
exactly as in the first option above, pass the report connection to your subreport and work from there

last record of subreport is repeating on next page of report

I created Report which is embedded with one subreport, when i Run the report then In some cases the last record of subreport is repeated on next page. I tried putting a float line just after the detail band of subreport but its not reflecting any changes. has someone also faces this earlier, please share how to tackle this

The subreport repeats itself in Detail band

I am new to JasperReports, basically I want to put a subreport in a mainreport
The problem is that I put the sub report in the Detail band, so when I query a database that has multiple data the subreport will always repeat itself multiple times when I output the report to a pdf. I want a report that does not repeat itself regardless of how many data I have in the database that i connect with
I have searched the Internet and the solutions is to add
new Boolean($V{REPORT_COUNT}.intValue()==1)
in the print when expression attribute of the subreport, that does solve a part of my problem due to the fact that now my subreport only prints once but it still leaves some blank pages after my subreport is displayed
So I assume it is still repeating itself but just doesn't print the data because of the expression that I added , people say that the nature of the detail band is supposed to work that way and that I shouldn't put the subreport in the detail band, but if I put it in some other band I get this error:
Error filling print... Subreport overflowed on a band that does not support overflow.
The error above will happen if I have a lot of data to the extent that it may take up more than a page.
How do remove those blank pages? If I am ask to not put it in a detail band then what should I do? or what solution are there?
The Detail band will be generated as many times as the number of records you have in your main dataSet(populated by the top-level query).
If you want to keep the subreport in the Detail band, which is normal by the way, you can do one of these things:
either have a dummy query that returns only one record, so that the Detail band generates only once. Then, pass the report connection to your subreport. You may have done that already. This way you can run your query independently of the main report.
or leave the report as-is and add your printWhen expression ($V{REPORT_COUNT}.intValue()==1) directly on the Detail band, not on the subreport. Please note that this is just an ugly hack that may affect the report performance. Your main query still returns a lot of data that you don't use so you should consider the other options.
If you can move the subreport out of the Detail band, place it in a band that allows overflow like Title or Summary band. Then:
have your main dataSet's query empty so that no Detail band gets generated
set whenNoDataType="AllSectionsNoDetail" at the report level(in the <jasperReport> tag) so that all the other sections except the Detail get generated
exactly as in the first option above, pass the report connection to your subreport and work from there

Export PDF and supress page breaks

When I export my report to pdf, appear me weird page breaks.
If a lengthy report, that happens to me is that if a table does not fit in the remaining space of a page, it automatically passes me to the page below, thus creating blanks spaces.
Already have enabled the property Keep Together, interactive size to 0 and i unchecked keep together on one page if possible in tablix properties.
However I think the problem is not in the table, because before that, I have a textbox with a title, and is between the table and the textbox that makes page break.
I have already put the textbox and table inside a rectangle, but still have this problem.
Any suggestions?
Q: is the table / text box that responsible for the page break issue is inside a Subreport ?
If so, then this is your problem (unless you make a call that this table will always be short enough to stay in single page).
You have to understand: the subreport is the cause for the breaking, the table will not split because it is presented by the sub-report that has to stay in one piece.
The options are:
Stay with the subreport - but make sure that the table Maximum length will still fit the Page that the sub-report is lay in it.
take out the table from the subreport and place it directly in the main report - that way when the table too long to stay in single page, it will split into two pages.

Getting JasperSoft's iReport to play nice with subreports and page breaks

I have a report with two subreports. The first subreport is very short, the second one is quite long. I would like the exported spreadsheet to have a single sheet/tab for each of these two subreports.
In the main report's layout, the two subreports separated by a page break.
When I export (or just view the html in the browser), the page break appears after the first subreport, but the second one is then chopped into several more pages (because its very long).
Now I could make the main report a million pixels in height, but that would be an ugly hack making the first subreport appear with data in the first 10 rows and followed by thousands of empty rows.
How can I fix this?
(It is driving me mad.)
the report has a property called "Ignore Pagination" (iReport 4.0.2). If checked, it will print the whole document as a single page.