sebastianr Posted February 20, 2008 Share Posted February 20, 2008 Hi, I am in need to getting total no of rows generated in jrxml from java program where my jasper execution is. But i dont want to execute a report query from java instead the query is there in the jrxml. I need to get a count of records from the query executed in jrxml template. Is there any way of achieving this? Link to comment Share on other sites More sharing options...
lucianc Posted February 20, 2008 Share Posted February 20, 2008 You can retrieve the value of the REPORT_COUNT variable after generating the report; more information on this here.HTH,LucianPost Edited by teodord at 08/19/2010 11:45 Link to comment Share on other sites More sharing options...
sebastianr Posted February 23, 2008 Author Share Posted February 23, 2008 Thanks Lucian. I have one more query for you which is related to perfomance. In my application, i'm using Apache's Velocity with Jasper to generate the template dynamically. And i'm passing the generated pdf data as byte stream to browser directly to write. In this case, what will be the performance when the concurrent users increase or report data volume is high or both. I'm really worrying about the performance since the template generation, compilation, report generation and writing report to browser window are online process(Once user is made the report request). Can you suggest me anything can be done to gain the good performance? Some times i am getting "OutOfMemoryException" when the report volume is so high (it cannot write the data in memory). To avoid such situation, i would like to have a pre-defined report bandwidth and will not allow the user to generate the report if the volume exceeds the bandwidth defined. Is this acceptable? My users are ok with that. Kindly share your expertise with me and suggest me the optimal way of approaching this problem. Thanks. :evil: Link to comment Share on other sites More sharing options...
sebastianr Posted February 23, 2008 Author Share Posted February 23, 2008 Hi Lucian, I am getting below exception when i tried this. (Jasper design is not allowing to add reportElement in summary section) <parameter name="returnMap" isForPrompting="false"/><summary> <staticText> <reportElement> <printWhenExpression>$P{returnMap}.put("var", $V{REPORT_COUNT}) == null ? Boolean.FALSE : Boolean.FALSE</printWhenExpression> </reportElement> </staticText></summary> Exception: Caused by: java.lang.NoSuchMethodException: No such accessible method: addElement() on object: net.sf.jasperreports.engine.design.JasperDesign at org.apache.commons.digester.Digester.createSAXException(Digester.java:3181) at org.apache.commons.digester.Digester.createSAXException(Digester.java:3207) at org.apache.commons.digester.Digester.endElement(Digester.java:1225) at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source) at org.apache.xerces.impl.dtd.XMLDTDValidator.endNamespaceScope(Unknown Source) at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source) at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) Link to comment Share on other sites More sharing options...
lucianc Posted February 26, 2008 Share Posted February 26, 2008 sebastianr wrote:I have one more query for you which is related to perfomance. Posting as a new thread would have been a better idea since now people will not understand what this thread is about. In this case, what will be the performance when the concurrent users increase or report data volume is high or both. I'm afraid I can't predict what the performance will be. You'll have to perform some tests to find out. Can you suggest me anything can be done to gain the good performance? Some times i am getting "OutOfMemoryException" when the report volume is so high (it cannot write the data in memory). If your scenario permits it, I suggest caching compiled reports so that you don't have to generate and compile reports at every request. To avoid such situation, i would like to have a pre-defined report bandwidth and will not allow the user to generate the report if the volume exceeds the bandwidth defined. Is this acceptable? My users are ok with that. If your users find it acceptable, I have nothing against it. Regards,Lucian Link to comment Share on other sites More sharing options...
lucianc Posted February 26, 2008 Share Posted February 26, 2008 sebastianr wrote:<summary> <staticText> <reportElement> <printWhenExpression>$P{returnMap}.put("var", $V{REPORT_COUNT}) == null ? Boolean.FALSE : Boolean.FALSE</printWhenExpression> </reportElement> </staticText></summary> This is not a valid JRXML fragment. The <subreport> element needs to include a <band> element, and <reportElement> has 4 required attributes. You can check the JRXML reference here. HTH,Lucian Link to comment Share on other sites More sharing options...
ardentbiker Posted October 9, 2009 Share Posted October 9, 2009 The above link to the JRXML reference is no longer available. Could someone post the new URL for the JRXML reference?Thanks. Link to comment Share on other sites More sharing options...
lucianc Posted November 24, 2009 Share Posted November 24, 2009 The JRXML reference can be found at http://jasperreports.sourceforge.net/schema.reference.htmlRegards,Lucian 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