How do I prevent a subreport from rendering over the top of other elements?

0
I am using Jaspersoft Stuido.
 
I have a master report that contains three sub-reports, named "vehicleListSubReport.jrxml", "locoSubreport.jrxml", and "crewSubreport.jrxml" Their datasources are the fields "vehicleReport", "locoReport" and "crewReport" respectively, which are all objects of type JRDataSource. I have attached the jrxml file for the master report, and a pdf file for a sample of the output.
 
I am having a few problems, but I feel that they may have a single root cause, hence why I am asking about them all in the same question.
 
First problem: The crewSubreport has other report elements below it, including the other two sub-reports. If there are multiple records in this sub-report, it renders on top of the elements below it, including the other sub-reports.
 
Second problem: The data text fields below the crewSubreport are rendering (although with the subreport rendering on top of them), however, the static text boxes with the labels "Train Summary", "Number Vehicles:", "Tonnes Hauled:", "Total Length:", "Locos:", and "Tonnes Gross:" are not rendering, and I not yet able to determine why.
 
Third problem: Similar to the first problem, the locoSubreport is rendering into the space occupied by the vehicleListSubreport.
 
How do I fix these issues?
 
EDIT: I am adding the jrxml file that I made by changing the position type of the elements below the first subreport to "Float". I am hoping someone can explain why this approach causes my program to throw the following OutOfMemoryError:
 
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | net.sf.jasperreports.engine.JRRuntimeException: java.lang.OutOfMemoryError: GC overhead limit exceeded
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at net.sf.jasperreports.engine.fill.JRFillSubreport.prepare(JRFillSubreport.java:783)
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:331)
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:384)
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:358)
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2091)
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:778)
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:288)
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:151)
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:939)
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:871)
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:114)
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:653)
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:569)
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:915)
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at au.com.fourtel.report.plugin.api.AbstractReportGenerator.fillReport(AbstractReportGenerator.java:58)
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at au.com.fourtel.report.plugin.api.AbstractGenerateReportAgent.generateResult(AbstractGenerateReportAgent.java:159)
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at au.com.fourtel.report.plugin.api.AbstractGenerateReportAgent.generateReport(AbstractGenerateReportAgent.java:81)
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at au.com.fourtel.report.plugin.api.AbstractGenerateReportAgent.processRequest(AbstractGenerateReportAgent.java:55)
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at au.com.fourtel.fourabs.src.FourAbsRequestProcessor.processRequest(FourAbsRequestProcessor.java:95)
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at au.com.fourtel.src.server.ProcessConnection.run(ProcessConnection.java:69)
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at java.util.HashMap.inflateTable(Unknown Source)
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at java.util.HashMap.put(Unknown Source)
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at net.sf.jasperreports.engine.fill.JRBaseFiller.createBoundElementMaps(JRBaseFiller.java:1241)
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at net.sf.jasperreports.engine.fill.JRBaseFiller.createBoundElemementMaps(JRBaseFiller.java:1217)
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:900)
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:871)
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at net.sf.jasperreports.engine.fill.JRFillSubreport.fillSubreport(JRFillSubreport.java:656)
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at net.sf.jasperreports.engine.fill.JRSubreportRunnable.run(JRSubreportRunnable.java:59)
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at net.sf.jasperreports.engine.fill.AbstractThreadSubreportRunner.run(AbstractThreadSubreportRunner.java:203)
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
INFO   | jvm 1    | 2014/03/19 14:55:09.567 | at java.lang.Thread.run(Unknown Source)
 
 
 
 
bgero's picture
2
Joined: Mar 24 2013 - 9:00pm
Last seen: 5 years 7 months ago

I forgot to mention, I am using JasperSoft Studio 5.5.1, and Jasper Reports library version 5.5.1.

bgero - 5 years 7 months ago

bgero,

Nobody is going to read jrxml codes you've pasted to the forum. Try attaching them instead. Also, screenshots of your problem probably would help too.

hozawa - 5 years 7 months ago

I have made the changes you suggested, though I attached a PDF sample report instead of making screenshots.

bgero - 5 years 7 months ago

1 Answer:

0

The Problem is, that your SubReport is within the same band as the other elements below.

If you do so, you should set all elements below to PositionType=Float instead the default "FixRelativeToTop" - otherwise the content of the SubReport will overlap the content of the MasterReport.

Other solution would be, to place the SubReport in it's own detail (you can add multiple detailbands).

 

hth + regards from Germany

C-Box

C-Box's picture
1945
Joined: Jul 19 2006 - 5:58pm
Last seen: 5 days 7 hours ago

Using PositionType=Float seems to cause the report to take a really long time to generate, and during that time the thread generating it dies with an OutOfMemoryError. I have just tried using extra detail bands like you said, but now each detail band appears on a separate page. I then tried setting "Ignore Pagination" on the report to true, but now it won't start a new page on a new report record, and instead only starts a new page when the data is too long for the same page.

I definitely need all the detail bands on the one page (except when the data is too long of course), and to have each report record appear on a new page.

Also, I still have the problem that some of the static text labels are missing.

bgero - 5 years 7 months ago
Feedback
randomness