adamzrk Posted February 20, 2007 Share Posted February 20, 2007 I have to use in my jrmxl template multiple JRBeanCollectionDataSources with different beans. Report will contain a few crosstabs. Can anyone tell me is this possible? Can I pass somehow multiple JRBeanCollectionDataSources to jrxml file and proceed it? RegardsAdam Link to comment Share on other sites More sharing options...
lucianc Posted February 20, 2007 Share Posted February 20, 2007 If you only intend to use each data source for a single crosstab, you can take the following approach:create a subdataset corresponding to the data sourcepass the JRBeanCollectionDataSource as a report parameterconnect the crosstab to the subdataset and use the JRBeanCollectionDataSource parameter as data source:Code:<crosstab> <crosstabDataset> <dataset> <datasetRun subDataset="myCrosstabDataset"> <dataSourceExpression>$P{myCrosstabDataSource}</dataSourceExpression> </datasetRun> </dataset> </crosstabDataset></crosstab>[/ul] HTH,Lucian Link to comment Share on other sites More sharing options...
adamzrk Posted February 20, 2007 Author Share Posted February 20, 2007 But what about <rowGroup>, <crosstabRowHeader> and other tags specific for <crosstab> ? Can have I multiple different crosstabs in my report? RegardsAdamPost edited by: adamzrk, at: 2007/02/20 10:24 Link to comment Share on other sites More sharing options...
lucianc Posted February 20, 2007 Share Posted February 20, 2007 What about <rowGroup> and <crosstabRowHeader>? I don't understand the question. And yes, you can have several crosstabs in a report. Regards,Lucian Link to comment Share on other sites More sharing options...
adamzrk Posted February 20, 2007 Author Share Posted February 20, 2007 Thanks. When I use Your suggestion I used JRBeanCollectionDataSource as parameter I got exception: 15:01:22,380 ERROR [Digester] End event threw exceptionjava.lang.NoSuchMethodException: No such accessible method: setDataSourceExpression() on object: net.sf.jasperreports.crosstabs.design.JRDesignCrosstabDataset at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:248) at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:216) Link to comment Share on other sites More sharing options...
lucianc Posted February 20, 2007 Share Posted February 20, 2007 How does your <crosstabDataset> look like? Link to comment Share on other sites More sharing options...
adamzrk Posted February 20, 2007 Author Share Posted February 20, 2007 <crosstabDataset> <dataset > <datasetRun subDataset="globalVisitCountPerPageDS" /> <dataSourceExpression>$P{globalVisitCountPerPage}</dataSourceExpression> </datasetRun> </dataset> </crosstabDataset> and on the start of my jrxml: <subDataset name="globalVisitCountPerPageDS"> <field name="pageName" /> <field name="userName" /> <field name="visits" class="java.lang.Long" /> </subDataset> Th fields come from java code:parameters.put("globalVisitCountPerPage", new JRBeanCollectionDataSource(someDao.getData())); Link to comment Share on other sites More sharing options...
lucianc Posted February 20, 2007 Share Posted February 20, 2007 adamzrk wrote: <crosstabDataset> <dataset > <datasetRun subDataset="globalVisitCountPerPageDS" /> <dataSourceExpression>$P{globalVisitCountPerPage}</dataSourceExpression> </datasetRun> </dataset> </crosstabDataset> This is not well-formed XML. Link to comment Share on other sites More sharing options...
adamzrk Posted February 20, 2007 Author Share Posted February 20, 2007 Hmm.. Why isn't it well-formed?The exception I showed doesn't tell anything about well-formed xml... Exception:net.sf.jasperreports.engine.JRException: Error at line 115 char 58: No such accessible method: setDataSourceExpression() on object: net.sf.jasperreports.crosstabs.design.JRDesignCrosstabDataset at line 115 in my jrxml I have:<dataSourceExpression >v</dataSourceExpression>the exception is the same even if it looks like:<dataSourceExpression >$P{globalVisitCountPerPage}</dataSourceExpression>or<dataSourceExpression ><![CDATA[$P{globalVisitCountPerPage}]]></dataSourceExpression> I have no idea what is wrong :( regardsPost edited by: adamzrk, at: 2007/02/20 13:52 Link to comment Share on other sites More sharing options...
lucianc Posted February 20, 2007 Share Posted February 20, 2007 As I said, the XML fragment is not well-formed: <dataset> start data set element<datasetRun subDataset="globalVisitCountPerPageDS"/> empty element (closed)<dataSourceExpression>..</dataSourceExpression></datasetRun> datasetRun was already closed two lines ago Link to comment Share on other sites More sharing options...
adamzrk Posted February 20, 2007 Author Share Posted February 20, 2007 me stupido....Thanks! regardsadam 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