Custom data source for a subreport

0

Hi all,

 

I have a (hopefully) simple question for experienced users.

Basically, how can I pass a custom datasource to a subreport, containing only current record in the main report's data source (which is an XML data source)? That is to say, my report prints invoices. So, in the main report I want to pass a datasource expression to a subreport that holds data only for one invoice, not the whole datasource.

I can pass the whole XML datasource of the main report, but that's not what I want, my idea is to pass only the current record.

 

Essentially, I have a main report which consist of two detail bands, each having a subreport. I can pass a data source to a subreport using the dataSourceExpression attribute of the subreport element:

where BASIC_DATA_SOURCE is a parameter that holds the value of built-in parameter $P{REPORT_DATA_SOURCE}:


 

 
 
So, how can I pass only partial data from a datasource?
 
 
BTW. I'm trying to do this using OpenERP's module jasper_reports and not a Java application, if that info is meaningful.
 
edit: sorry about the unfitting screenshot, I have trouble pasting code snippets here
 
puppetmaster.tb's picture
Joined: Feb 5 2013 - 8:22am
Last seen: 6 years 6 months ago

2 Answers:

0

any ideas, anything? can I use a scriptlet to create a new datasource from the main report's XML datasource  and write it to a parameter?

 

I tried passing the following in subreport datasource expression, but it doesn't  work with OpenERP's jasper_reports module which doesn't recognize the expression:

"((net.sf.jasperreports.engine.data.JRXmlDataSource)
$P{REPORT_DATA_SOURCE}).dataSource("/root")"

puppetmaster.tb's picture
Joined: Feb 5 2013 - 8:22am
Last seen: 6 years 6 months ago
0

This is the same issue as mine:

http://community.jaspersoft.com/questions/513715/use-same-jrxmldatasource-multi-subreport

in the 3rd post by CBox it is stated that the solution can be:

"making your own method that returns the datasource with calling the "moveFirst" method before"

 

in short, how to do that in ireport, by writing a scriptlet and passing the result to a parameter which is used in the subreport's datasource expression?

puppetmaster.tb's picture
Joined: Feb 5 2013 - 8:22am
Last seen: 6 years 6 months ago
Feedback
randomness