Jump to content
We've recently updated our Privacy Statement, available here ×

Multiple subreports in one master file


pals169

Recommended Posts

Hello All,

I Have issue with displaying 2 subreports in one master report. problem is that both the sub-report should  print one after another.but it is not happening.  It willl print  first  line of one subreport and after that  it will print first line of second report. and it will print whole report in this manner.

 

Attached here the file for that

Link to comment
Share on other sites

  • Replies 10
  • Created
  • Last Reply

Top Posters In This Topic

Thanks sooooooooooooooo much jmartens..... that issue has been solved :) but i have another issue can you please help me

 

I have now  one subreport inside another subreport. when i try to generate pdf from that it throws exception that "could not load object from jasper file " can you please help me in that ..

I am waiting for your valuable inputs

 

here patientNoteFinal is master report.

historyQuestTab.jrxml is the sub-report that is to be included in master report.

historyQuestGrp.jrxml is to be included in historyQuestTab.jrxml as a subreport.

historyQuest.jrxml is to be included in historyQuestGrp..jrxml as a subreport.

 

Could  u pls look into these attached file and please let me know where i am going wrong.

 

Link to comment
Share on other sites

What you need is to compile all you subreports before filling your mastr report.

You can do it by clicking on preview button - we are expecting a compile button in the next version.

I've succeeded running you report



Post Edited by andfedotov at 13/05/2009 04:48 PM
Link to comment
Share on other sites

Hi andfedotov,

Kindly Explain the steps u have performed to run the above reports that i have sent . bcoz i have complied all my files and try to run but i found this error  "net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: Could not load object from location : .\historyQuestGrp.jasper".

 

Your help is precious to me .Waiting for your guidence.

Link to comment
Share on other sites

I assume your reports are working fine when you just have a single level of subreports. I'm also assuming that you're trying to run these in an application and you're passing in the SUBREPORT_DIR parameter to your top-level report. What's happening is when your first level of subreport wants to load the second-level subreport it is looking for it at $P{SUBREPORT_DIR}+"whatever.jasper" and it's using the default value of SUBREPORT_DIR (which is ".\\"). What you need to do is have your top-level report explicitly pass its value of SUBREPORT_DIR down to the first level subreport, so it has it available for when it needs to load the 2nd level subreport. I made the same mistake the first time I did nested subreports.
Link to comment
Share on other sites

  • 4 weeks later...
  • 1 month later...

Sorry.  I haven't checked the forum in a while - working on another project.

In your top-level report, right click on the subreport element and bring up the Properties window.  Go to the "Subreport (other)" tab and at the bottom it shows the "subreport parameters".  Click the "ADD" button to add a new parameter.  The "name" is the name of the parameter expected by the subreport (e.g. "SUBREPORT_DIR"), and the expression is where to get the value from the main report (e.g. $P{SUBREPORT_DIR} )

Hope that helps.  (You'd probably figured it out already).

James

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