bluecrosschris Posted January 7, 2011 Share Posted January 7, 2011 In order to create an eight page report, I created eight sub-reports, the pulled those into a main report with sub-report, page-break, sub-report, page break, etc.When I compile and run the sub-reports individually, I'm prompted to enter values for all of my parameters, and it pulls those in and displays them perfectly. The problem I have is when I compile and execute the main report, I'm not prompted and all fields for the sub-reports are null.My question is:How do I get the main report to prompt me for the values it needs to populate all of the sub-reports? Link to comment Share on other sites More sharing options...
saman0suke Posted January 7, 2011 Share Posted January 7, 2011 You need to define the parameters on the main report, then right click on the subreport area (on the main report), on properties on Subreport(all), on subparameters tab, click on "Copy from master", then you need to define on the subreport, the same parameters you created on the main report, and that's it, when you run the main report is going to ask you for those parameters and the values will be send to them, good luck. Link to comment Share on other sites More sharing options...
bluecrosschris Posted January 7, 2011 Author Share Posted January 7, 2011 Thanks for the quick reply. I actually figured this one out. I was trying to do the opposite. Define Parameters in main report then "match up" to existing parameters in sub-report. My question now is, I've linked this main report to a .jsp that fills the parameters and creates the PDF by plugging parameters into the subreports/report. But, when I have all of my subreports in the detail section of the report (or even just compiling a single subreport), nothing displays. If I move my parameters into any other section of the report, it generates fine. This is a problem because, I have eight subreports and obviously I can't put those in the header or column header of the main report because then it would put each subreport on every page of my report. Hope this makes sense.Any help is appreciated. Link to comment Share on other sites More sharing options...
cbarlow3 Posted January 7, 2011 Share Posted January 7, 2011 I don't know if this is your problem or not, but the process you and the previous poster described doesn't sound familiar to me. I think what you need to do is #1 define a VARIABLE (not a parameter) in the main report where you want the value from the subreport to end up. You also have to have VARIABLE of the same data type defined in the subreport that will have the correct value in it at the time the subreport completes. The two variables don't have to have the same name, although that would of course be convenient.Then, in the main report, select the subreport, scroll to the bottom of the Properties pane, and select the "Return Values" "..." button, which brings up a dialog where you can ADD return values. You enter the Subreport variable (notice that it ASSUMES you are using a variable...no $V{} syntax required)...it will NOT appear in the dropdown unless it's a standard system-defined variable, but you can just type in the name. And you enter the "Destination Variable" which means the name of the variable in your MAIN report where you want the value to end up. This time the dropdown should include the variable you want to use as a destination.Once that's done, you should be able to use that variable in your report. If you are displaying that variable it in the SAME detail band where the subreport is, be sure to set the "Evaluation Time" of that field to "Band".Hope that helps. Link to comment Share on other sites More sharing options...
etsat Posted February 4, 2011 Share Posted February 4, 2011 Hi gentlemen,I'm just starting on JasperReports, but concerning this topic I advise you to take a look at the following post:http://jasperforge.org/plugins/espforum/view.php?group_id=83&forumid=101&topicid=71452This is turn forwards to the following BUG in JasperReports:http://jasperforge.org/projects/jasperreports/tracker/view.php?id=3260 So, the synchronization of data from subreports into the main report simply does not work if you need to process everything in the same band. I've spent the last couple of days trying to figure out something that would work :( The best advise I can give you is, if you need to use the data from the subreport in the Main report, use a different band. For example in the main report create a new detail band after the subreports' band, where you you will then process the information coming from the subreports. By the time the 2nd band is rendered the 1st one has already been processed and the data from the subreports is stable and processed. That way you will save a lot of time trying to find the optimum "Evaluation Time" which obvisously won't work because there's a bug. I hope I have contributed :)Post Edited by etsat at 02/04/2011 16:15 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