Jump to content
We've recently updated our Privacy Statement, available here ×

dsrini.open

Members
  • Posts

    6
  • Joined

  • Last visited

dsrini.open'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. you might have given the field with the type - java.lang.Date - there is no type in java, it is java.util.Date Even, I am trying to have a date field, let me know if you are successfull.
  2. When testing with subDataSource, I am able to execute the report, but the subdatasource moves the main datasource by one element, thus the first record is lost in my subreport. To fix this, I am passing in the two datasources to the report (one for main, and one for subreport), thus having two select expressions. There is a moveFirst() method, but unable to use in jasperReports, as it returns void. Also, I am not sure of a way to do this from java while the report is in process. Your response is much welcome. Thanks.
  3. I am not sure about file input - what I've done is String input which is a json - def jsonBytes = ((String) jsonData ).getBytes()streamForReportSource = new ByteArrayInputStream(jsonBytes);dataSource = new JsonDataSource(streamForReportSource, _defaultJSONSelectExpression)reportDef.jasperPrinter = JasperFillManager.fillReport(reportDef.getReport().inputStream, reportDef.parameters, dataSource)[/code]reportDef is nothing but JasperReportDef in grails- jasper plugin. One doesn't have to use this though. This one works perfect.
  4. Did anyone get to work with JSON successfull ? I had tried with both - passing json as string, as a file, both is of no use, though the contents of the file, string are correct. Though when i give the net.sf.jasperreports.json.source value to be a file location in ireport and eclipse plugin, the report is generated successfully. So the preview functionality works fine. Seems like there is post which gives useful info, - http://www.grantcurrey.com.au/blog/2013/01/26/using-jsondatasource-with-jasperreports/ Tried that too, nope not successfull, not sure how the author mentioned the properties value with - net.sf.jasperreports.json.sourceJSON_INPUT_STREAMIf anyone knows / can be helpful please do reply. Does anyone from jaspersoft monitors such threads ?
  5. I am getting the same kind of pdf for demo in jasperDemo/demo - under sample-list-domain-classes That tells there is something wrong in the report Generation, and not with my controller / my jrxml report definition. Might be the plugin's not working as part of 1.8.0 version ?
  6. I am trying to mirror the grails report generation blog, (but in grails 2.3.7 / jasper plugin 1.8.0)- http://ironicprogrammer.blogspot.com/2009/09/creating-jasper-reports-in-grails.html In the my BookController.groovy file i have - def createReport = { def books = Book.list(params) log.debug(books.toString()) chain(controller:'jasper',action:'index',model:[data:books],params:params) log.debug("File printed successfully.")}[/code] In my index.gsp file i have, <g:jasperReport controller="book" action="createReport" inline="true" jasper="books.jrxml" format="PDF" name="All Books" > [/code] I am always getting a blank PDF though the content looks different - %PDF-1.4%âãÏÓ1 0 obj<</Length 29/Filter/FlateDecode>>streamxœ+ärá26S°00SIáráäâ 13-endstreamendobj3 0 obj<</Group<</Type/Group/CS/DeviceRGB/S/Transparency>>/Parent 2 0 R/Contents 1 0 R/Type/Page/Resources<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]/ColorSpace<</CS/DeviceRGB>>>>/MediaBox[0 0 595 842]>>endobj2 0 obj<</ITXT(2.1.7)/Type/Pages/Count 1/Kids[3 0 R]>>endobj4 0 obj<</Type/Catalog/ViewerPreferences<</PrintScaling/AppDefault>>/Pages 2 0 R>>endobj5 0 obj<</Creator(JasperReports (report name))/Producer(iText 2.1.7 by 1T3XT)/ModDate(D:20140425165259-05'00')/CreationDate(D:20140425165259-05'00')>>endobjxref0 60000000000 65535 f0000000015 00000 n0000000326 00000 n0000000110 00000 n0000000389 00000 n0000000480 00000 ntrailer<</Root 4 0 R/ID [<5ff4d9752fefdbe898e3b7311f196e7e><31c6a083d568eac2c6c2f5cdd3ce6db5>]/Info 5 0 R/Size 6>>startxref641%%EOF[/code]The books.jrxml looks like this - <?xml version="1.0" encoding="UTF-8"?><jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="report name" pageWidth="595" pageHeight="842" columnWidth="535" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20"> <property name="ireport.scriptlethandling" value="0"/> <property name="ireport.encoding" value="UTF-8"/> <import value="net.sf.jasperreports.engine.*"/> <import value="java.util.*"/> <import value="net.sf.jasperreports.engine.data.*"/> <style name="pagetitle" isDefault="false" fontName="SansSerif" fontSize="14"/> <field name="title" class="java.lang.String"/> <field name="author" class="java.lang.String"/> <field name="publisher" class="java.lang.String"/> <field name="category" class="java.lang.String"/> <background> <band/> </background> <title> <band height="79"> <staticText> <reportElement style="pagetitle" x="0" y="0" width="201" height="46"/> <text>Some text <![CDATA[books]]></text> </staticText> <break> <reportElement x="0" y="29" width="100" height="1" uuid="71e38fc6-6790-4cae-9951-d10d4b81e6cd"/> </break> </band> </title> <pageHeader> <band height="35"/> </pageHeader> <columnHeader> <band height="61"> <staticText> <reportElement key="staticText" x="0" y="39" width="100" height="20"/> <text><![CDATA[$P{name}.toString()]]></text> </staticText> <staticText> <reportElement key="staticText" x="0" y="39" width="100" height="20"/> <text><![CDATA[Title]]></text> </staticText> <staticText> <reportElement key="staticText" x="130" y="39" width="100" height="20"/> <text><![CDATA[Author]]></text> </staticText> <staticText> <reportElement key="staticText" x="266" y="39" width="100" height="20"/> <text><![CDATA[Publisher]]></text> </staticText> <staticText> <reportElement key="staticText" x="396" y="39" width="100" height="20"/> <text><![CDATA[Category]]></text> </staticText> </band> </columnHeader> <detail> <band height="42"> <textField isBlankWhenNull="false" hyperlinkType="None"> <reportElement key="textField" x="0" y="15" width="130" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{title}]]></textFieldExpression> </textField> <textField isBlankWhenNull="false" hyperlinkType="None"> <reportElement key="textField" x="130" y="15" width="136" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{author}]]></textFieldExpression> </textField> <textField isBlankWhenNull="false" hyperlinkType="None"> <reportElement key="textField" x="266" y="15" width="130" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{publisher}]]></textFieldExpression> </textField> <textField isBlankWhenNull="false" hyperlinkType="None"> <reportElement key="textField" x="396" y="15" width="147" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{category}]]></textFieldExpression> </textField> </band> </detail> <columnFooter> <band height="45"/> </columnFooter> <pageFooter> <band height="54"/> </pageFooter> <summary> <band height="42"/> </summary></jasperReport>[/code]I tried by placing both books.jrxml/ books.jasper / both in the web-app/reports directory. Any idea on what's going on ? Everything looks the same as in the blog, except the pdf / xls / html report generation is not happening properly.
×
×
  • Create New...