jasonp_1 Posted April 16, 2013 Share Posted April 16, 2013 I have been racking my brain trying to understand how to use subreports. I come from the Microsoft Reporting Services world so some of the concepts in JasperReports is a bit foreign to me. One of the main reasons I would like to use subreports is to support reusability. I could define a report segment once and then use it in multiple reports. If I am just using iReport, the concept seems to work great. However, if I plan on using the reports in the JasperServer, it seems to fall apart. In order for a report in JasperServer to access a subreport, it must be embedded in the resources folder of the report as a .jrxml file. This appears to then be a "copy" of the original report. This means that if I need to make changes to my report segment, I need to copy the changes to every report that is using it. It seems that one of the key uses of subreports is nullified when working in the server environment. Am I missing something?Please help this newbie out!-Jason Link to comment Share on other sites More sharing options...
Ankur Gupta Posted April 17, 2013 Share Posted April 17, 2013 Hi, In the Jasper Server , for the subreports to be embedded into the one main report we need to add the subreport JRXML files as the resources , which is an option when we add a new jasper report in the repository . So for example,if there are two Reports which use a single subreport segment , so that particular subreport jrxml need to be inserted into the resources of the reports when they are added, rather adding it into a seperate resource folder. So this solves the problem of reusability if changes are done in that segment they automatically get updated in the reports wherever they are used ,so no extra efforts for copying the changes, or maintaining a seperate copy of the segment for every report. Link to comment Share on other sites More sharing options...
jasonp_1 Posted April 17, 2013 Author Share Posted April 17, 2013 So how would the subreport be referenced if it is in a separate folder? I understand that "repo:subreport.jrxml" is the standard way to reference it but that doesn't seem to work if it is in another folder. Link to comment Share on other sites More sharing options...
Ankur Gupta Posted April 18, 2013 Share Posted April 18, 2013 For the Jasper Report You need not upload the subreports separately but they need to be put into the resources of the Jasper Report so only one Jasper Report file is made with the resources specified inside it. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now