2004 IR Help Posted August 24, 2006 Share Posted August 24, 2006 By: macoute3 - macoute3 Subreport and JRDataSourceProvider 2005-11-17 07:55 I'm using JasperReports with HQL in the queryString. Description: in the query string: select cpy.name from Company as cpy Through the template query, fields and parameters my DataSourceProvider build a DataSource with the data found. This solution works fine. But the problem arrived with subreport. In the parent template: select cpy.name from Company as cpy In the subreport: select cpy.country from Company as cpy where cpy.name = $P{CompanyName}. Parameter send to subreport: CompanyName = $F{cpy.name}, of course. My problem is: How to execute the subreport query? If I send the parent DataSource, country isn't in the result. If I send a connection, I'm not using SQL based query. Code used: asperReport jasperReport = JasperCompileManager.compileReport("CompanyList.jrxml"); HibernateDataSourceProvider dsp = new HibernateDataSourceProvider(); JRDataSource ds = dsp.create(jasperReport); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, null, ds); Thanks for your response. By: Kolesnikov Alexey - kolesnikov RE: Subreport and JRDataSourceProvider 2005-11-17 22:58 Hi, I think sometimes it's easy to send JRDataSource directly to subreport by parameters map. I'm using this technique for my project. For instance, my main report has two subreports. I prepare two DS for them in Java application and put it to parameters map. Subreports configured to use datasource from the parent parameters map for course. Make sense? Alexey. By: del-piero - del-piero RE: Subreport and JRDataSourceProvider 2006-01-12 02:39 hi, i have one master report and two subreport when i where using regular connection the subreports where working fine. But when i changed the connection using JRBeanArrayDataSource the subreport stop working at all and i see only the master report... if the problem is known to you please answer me. thanks a lot. 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