ageofjava Posted May 10, 2010 Share Posted May 10, 2010 I created a subreport with no parameters. I found the subreport didn't display as expected. If run the subreport itself, it does display.Here's the iReport screenshot./uploads/projects/ireport/image/ageofjava/mainReport.jpg The following picture is the FileSafe Backup Report I'm currently using. I'm trying to migrate to JasperReports./uploads/projects/ireport/image/ageofjava/report1.jpg Thanks advance for any help.Post Edited by ageofjava at 05/10/2010 09:36Post Edited by ageofjava at 05/10/2010 09:43 Link to comment Share on other sites More sharing options...
tmatyashovsky Posted May 10, 2010 Share Posted May 10, 2010 In order to sub report display you need to pass some data (data source) to it.Can you please describe in details your sub report configuration? Best regards,Taras Matyashovsky Link to comment Share on other sites More sharing options...
ageofjava Posted May 11, 2010 Author Share Posted May 11, 2010 Taras, thanks very much for your kind help.The subreport uses the same connection as the master report, the local FileSafe-Backup-20100330-162507-001-129144110565671150.xml file. I created the subreport and the master report separately and then add the subreport to the master by dragging the "Subreport" icon from the palette. I didn't sepcify any parameters for the subreport.I thought the subreport already had its own data source. Should I pass a data source to it from the master report?You can run the report after simply downloading the 3 attachments to a same folder. filesafebackup.jrxml is the master report, clientsnotbackedup.jrxml is the subreport and FileSafe-Backup-20100330-162507-001-129144110565671150.xml is the data source used by both the reports.Best regards,LingPost Edited by ageofjava at 05/11/2010 03:06 Link to comment Share on other sites More sharing options...
tmatyashovsky Posted May 11, 2010 Share Posted May 11, 2010 Hi Ling, When you create sub report the wizard should appear.In mentioned wizard on the step2 please select appropriate connection (from the master report or create a separate one). On the step 3 do not forget to pass some parameters from master report to the sub report if needed. Hope that will help. P.S. Cannot find attachment. Please upload it once more if it won't help. Link to comment Share on other sites More sharing options...
ageofjava Posted May 12, 2010 Author Share Posted May 12, 2010 The sub report still doesn't display, although it gets display if running it as a master report. The attachments are located at the bottom of the thread #74189. Please search the string "Attachments:" in this page. You'll see the 3 attachments right below the highlighted "Attachments:". Thanks again for your kind help. Link to comment Share on other sites More sharing options...
tmatyashovsky Posted May 12, 2010 Share Posted May 12, 2010 I investigated the problem you have.First of all, correct the name of sub report to clientsnotbackedup.jasper. But that's the minor issue.Also don't forget to pass parameters from master report to sub report. This is done in parameters property of sub report element. Select it and press copy from master andchoose needed parameters. One is for sure needed - SUBREPORT_DIR.The main issue: you have not set the data source for the sub report.To do that: select your subreport element. change connection type to "use a data source expression" change data source expression to ((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/report/client[@status=never]") the path "/report/client[@status=never]" was taken from yours subreport query, correct it if needed run the master report that worked for me. If it will work for you - add some karma points :) Best,Taras Matyashovsky Link to comment Share on other sites More sharing options...
ageofjava Posted May 13, 2010 Author Share Posted May 13, 2010 Taras, The solution works for me. Thanks a lot for your continuous help. Because the sub report used the same local xml file as the master one, I selected the option "use the same connection as the master report". It was wrong. For sure, you got your karma points Sincerely, Ling 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