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

passing JRCsvDataSource to a subreport


miro

Recommended Posts

Hi,

 

I'd like to include a subreport using JRCsvDataSource in a master report's summary band. I compile both the reports and then fill the master one using

 

JasperFillManager.fillReportToStream(in, out, params, dataSource);

 

but the subreport doesn't show.

 

?? Any idea why that could be ??

 

I have already set the datasource expression of the subreport to $P{REPORT_DATA_SOURCE} so that it has it, but still...

 

Thanks, miro

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Hi,

 

Passing the same data source to the subreport is not a good idea. I'm not sure this is what you need to do.

Using subreports means you have some hierarchy in the data... something like parent-child tables in a relational database. The subreport should get its own data source instance, maybe reading from some other CVS file...

Hard to say without more details.

 

I hope this helps.

Teodor

Link to comment
Share on other sites

Hi Teodor,

thanks for the post. I will try to give you more details:

- my master report actually doesn't use the datasource. I need it only for the subreport. :) Therefore I have to pass somehow the parameter from the master to the subreport.

- with the command $P{REPORT_DATA_SOURCE}.toString in a text field i found out that the subreport gets the same object like the master.

- if I use the same subreport as a master report it works and the datasource is read, but this is not the case when it is a subreport.

- through some testing (using new JRDataSource($P{REPORT_DATA_SOURCE}) as the value for the Datasource Expression) I found this code snipplet:

 

value = (net.sf.jasperreports.engine.JRDataSource)(new JRDataSource(((net.sf.jasperreports.engine.JRDataSource)parameter_REPORT_DATA_SOURCE.getValue())));

 

I am wondering what parameter_REPORT_DATA_SOURCE.getValue() does when the class type of this parameter is JRDataSource and this interface doesn't have a getValue() method?

 

Thank you very much for answering and helping.

Best, Miro.

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