ladef Posted October 6, 2006 Share Posted October 6, 2006 I would like to create report with 2 subreports.Each report use the same xml datasource. My problem is that the second subreport is empty.In fact, after the first subreport, the datasource position is to the end... Do you know how i cant reset the position of the xml datasource to the begining (rewind) ? Thank you for help. Link to comment Share on other sites More sharing options...
homer Posted October 7, 2006 Share Posted October 7, 2006 Hi, I assume you have this xml : <root> <subelement>..</subelement> <subelement>..</subelement></root> and you want iterate through subelement elements in the main report, try this in the datasource expression : choose "Use datasource expression" in combolistandtype "((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).dataSource("/root/subelement")"in the textfield. This will reset the datasource in the subreport because it'll create a new one. Hope this will help you. Link to comment Share on other sites More sharing options...
C-Box Posted October 7, 2006 Share Posted October 7, 2006 Perhaps creating a new DataSource is not a good solution (performance of XML Datasources is anyway not the best) As I don't work with XML DataSources but with CustomDataSources instead, I would suggest making your own method that returns the datasource with calling the "moveFirst" method before. just my two centsC-Box Link to comment Share on other sites More sharing options...
ladef Posted October 9, 2006 Author Share Posted October 9, 2006 Thank you. I tried : $P{REPORT_DATA_SOURCE}).dataSource("/root/subelement")It's ok. I will try (when possible) the second solution (moveFirst). It's a better solution when we work with lot of data. :) 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