Jump to content


Recommended Posts

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
Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

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:


Link to comment
Share on other sites

This is the same issue as mine:


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?

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