Jump to content

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


bgero

Recommended Posts

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)

 


 


 

 

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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

Link to comment
Share on other sites

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.

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