Jump to content

priyankdev

Members
  • Posts

    4
  • Joined

  • Last visited

priyankdev's Achievements

Rookie

Rookie (2/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. Hi, I am making a call to jrxml to generate report like this JasperReport jasperReport = JasperCompileManager.compileReport(reportSource); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, paramSMap, conn); But I have to create the conn object using conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/mydb", connectionProps); The thing is at other pages I use the Datasource object which we have specified in our DataSource.groovy , like: javax.sql.DataSource dataSource def myappsql = new Sql(dataSource) myappsql.rows(queryString) So I need to reuse the datasource so that I donot need to create the connection object with all the url, userid and pwd values specially in the reportsservice page as we need to remove all hardcoded sql connections from each file
  2. Thanks for the tip, I figured out the issue, the jquery.ajax() call had a timeout issue, I am setting the timeout attribute to a large number now and the url call doesnt get timed out! Another really important issue I fixed was if the report sze returned from compiling and printing using jasperprint is 0 (no results in query), then I was getting a JRException: page index out of range 0 of -1 error. I fixed this by doing a check on size befor I instantiate the exporter. something as follows so the JRException was because of exporter.exportReport() call on an empty report... Code: JasperReport jasperReport = JasperCompileManager.compileReport(reportSource); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, paramSMap, conn); reportSize =jasperPrint.getPages().size(); if (reportSize>0){ JRExporter exporter = new JRHtmlExporter(); exporter.setparameter(......)................ .... all other params are set exporter.exportReport(); } else { return "NO DATA" }
  3. Hi, I am running a jrxml from my grails application, it takes a parameter which I fill up during run time, after that I click run. Internally I make a jquery.ajax() call and set all the url & parameters to invoke the appropriate function in the controller which gets generates the resultstring and I print the resultString in the forwarded gsp page. Whats happeining right now is that After I fill the parameter and click run the 'Loading..' spinner comes and it goes on, I check the url in the firebug and it shows 'aborted'. The report is getting generated in the backend, I print the report page size - it gives the right value, which means my report service ran successfully (jasper.complile & jasper.fill). The report runs well in iReport. And here is the most important part. I try to invoke the url munually (which I execute on 'run' click ) it does generate the report properly. So what it means is the report is not getting displayed in the application (the url which runs seperately is actually a page inserted in the app). looking by it I think its related to how I am rendering the ResultString in the resultpage.gsp and then inserting this page in the main application gsp., but I need to know how to fix this issue. I am passing 8 parameters in the URL which makes it a long string. I also see that URL is invoke as GET , so is there a limit on its length? Attaching screenshots when I run the report from the APP, and then I invoke the URL directly in a new brwoser tab , from the firebug.
  4. Hi , I am rendering jasper reports on a webpage by compiling the jrxml in groovy-grails (rendering the result string in a .gsp page) Here is the main code in the service class def runReport(paramSMap, rep_id, pageno) { def pg = pageno JasperReport jasperReport = JasperCompileManager.compileReport(reportSource); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, paramSMap, conn); JRExporter exporter = new JRHtmlExporter(); ByteArrayOutputStream byteArray = new ByteArrayOutputStream(); if (pg!=null){ int pgc = new Integer(pg); println "inside pg-ck" exporter.setParameter(JRHtmlExporterParameter.IS_WHITE_PAGE_BACKGROUND,Boolean.FALSE); exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, Boolean.FALSE); exporter.setParameter(JRHtmlExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,Boolean.TRUE); exporter.setParameter(JRHtmlExporterParameter.PAGE_INDEX, pgc); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, byteArray); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRHtmlExporterParameter.IS_WRAP_BREAK_WORD,Boolean.TRUE); if (pgc==0){ println "inside pg" reportSize=jasperPrint.getPages().size(); } exporter.exportReport(); String renderdStr=new String(byteArray.toByteArray()); return renderdStr; } and I am displaying the renderd string in the result.gsp page. The report runs successfully each time I run an appropriate jrxml (i validate the jrxml first by running it in ireports). But the rendering on html fails sometimes for no reason. If I run the same report again from the front end it displays properly. But sometimes during the first run it does not display anything but a "Loading" spinner continuously. I initially thought its related to report size, like for very large report reading the jrxml / compiling/filling/ writing the outputstream etc, somewhere it gets timed out . but its happening for 1 page report also. I really need to know why its failing sometimes and working at other times, we need to make this a dependable process, like is it a good idea to use JrVirtualizer which I think is preferred for large reports. Thanks in advance, Priyank Devurkar
×
×
  • Create New...