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

cristic83

Members
  • Posts

    8
  • Joined

  • Last visited

cristic83'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 guys, We are facing a problem while generating pdf reports with Jasper 3.7.6. We are generating PDF reports using Jasper into several languages like French, Spanish, German and English and in order to support special characters for all these languages we have used the jasper fonts you can find in the attachment. We are using the jasper libraries and fonts attached to this post to generate the pdf reports. Most of the times the report generation works just great, but sometimes our jboss server crashes entirely while trying to export the report to pdf. The stack trace of the problem looks like this: In the attachment you can find a file with a detailed description of the crash and the jasper libraries we are using. Any help regarding this issue would be highly appreciated. Cheers, Cristi Code: Post Edited by cristic83 at 03/12/2012 09:58 Post Edited by cristic83 at 03/12/2012 09:59
  2. Hi guys, I want to generate a report whose header is different depending on the data that's inside the report: e.g if I show data for a month then the header should be "Monthly report" and if the data is for a week the header should be "Weekly report". Of course, the header should be internationlized. I tried to solve this by using a parameter named reportType that's passed to the report template and then in the report template do something like this for the report header: $R{$P{reportType}+".report.title"} This doesn't work; when I try to compile this(in iReport) I get the following error: Syntax on token "$R", Assignment Operator expected after this token. Is there a way how I can achieve this? As a workaround, I could use the $P{reportType} parameter to contain the value of the resource bundle item that I nedd to display, but I don't want to do this because then if the resource bundle changes the references to it would have to be changed both in the report template and in the code. Thanks, Cristi
  3. Hi, Thanks for taking the time to clear things out. I had already noticed the effect you described regarding the record pointer moving, I just used that setup to see some records in the subreport. What I really want to achieve is to group some unrelated reports, each having its own data source, into one main report which doesn't have or need a data source, because it does not have data of its own to show. What I don't know how to do is how do I run the main report in this case: how do I pass the data sources to the sub reports? I was not able to find such an example with google. I also followed the tutorial you suggested, but the link for the sample Subreport(http://jasperforge.org/sf/wiki/do/viewPage/projects.jasperreports/wiki/Samples) is broken.
  4. Hi, Maybe I have not understood how things should be done correctly, so I will explain below what I did to getfeedback about the correct way to do it. First, I have used SampleJRDataSourceFactory to create a test JavaBean datasource that I wanted to use in my subreports. I set this data source as default so that it is used in every report. Each javabean contains a field firstName field that I want to use in the subreport. I need to use JavaBeans datasources not SQL, so I will have no SQL queries neither in the main report, nor in the subreport. Then, I created the subreport, added a field called firstName to the subreport and placed it in the subreport details section(or summary section) and then previewed the subreport, obtaining the expected results(the subreport uses the default datasource for previewing and when the firstName is placed in the details section several records are shown and when the firstName is placed in the summary section only one record, the last one, is shown). Afterwards, I created the main report and added the subreport element to the summary and/or the detail sections. I set the Connection Type property to "Use a datasource expression" and I set the "Datasource expression" to "$P{REPORT_DATA_SOURCE}". At this step I am expecting that the subreport datasource will be set to the main report datasource. Therefore, what I was expecting when previewing the main report was that the default datasource is used for the main report and that this datasource is passed to the subreport, which prints the firstName field for each record in the datasource. Obviously, this way of thinking is not the proper one, but I don't know how I should do the things. I attach the code for the main report and the subreport(the subreport is in the summary section of the main report and the firtName field of the subreport is still in the summary section). Thanks for taking the time to clear things out. Code:--main report<?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="MainReport" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20"> <property name="ireport.zoom" value="1.0"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="69"/> <parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false"> <defaultValueExpression><![CDATA["/home/ccioriia/workspace-sts/webstat2/backend/services/restFacade/src/test/resources/"]]></defaultValueExpression> </parameter> <queryString> <![CDATA[]]> </queryString> <field name="lastName" class="java.lang.String"> <fieldDescription><![CDATA[lastName]]></fieldDescription> </field> <background> <band splitType="Stretch"/> </background> <title> <band height="79" splitType="Stretch"> <staticText> <reportElement x="330" y="24" width="100" height="20"/> <textElement/> <text><![CDATA[static text]]></text> </staticText> </band> </title> <pageHeader> <band height="94" splitType="Stretch"/> </pageHeader> <columnHeader> <band height="98" splitType="Stretch"/> </columnHeader> <detail> <band height="58" splitType="Stretch"/> </detail> <columnFooter> <band height="26" splitType="Stretch"/> </columnFooter> <pageFooter> <band splitType="Stretch"/> </pageFooter> <summary> <band height="87" splitType="Stretch"> <subreport isUsingCache="true"> <reportElement x="96" y="17" width="100" height="48" isPrintWhenDetailOverflows="true" backcolor="#FFFFFF"/> <dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></dataSourceExpression> <subreportExpression class="java.lang.String"><![CDATA[$P{SUBREPORT_DIR} + "SubReport2.jasper"]]></subreportExpression> </subreport> </band> </summary></jasperReport>--subreport<?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="SubReport2" language="groovy" pageWidth="270" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="270" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0"> <property name="ireport.zoom" value="1.0"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="0"/> <field name="firstName" class="java.lang.String"> <fieldDescription><![CDATA[firstName]]></fieldDescription> </field> <background> <band splitType="Stretch"/> </background> <detail> <band height="48" splitType="Stretch"/> </detail> <summary> <band height="50"> <textField> <reportElement x="99" y="13" width="100" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{firstName}]]></textFieldExpression> </textField> </band> </summary></jasperReport>
  5. Thanks for replying. I have tried to put a static text in the detail section of the master report, in addition to the subreport element, but only the static text is displayed. I have also moved the subreport element in the summary, title or page/column header sectios but still the content of the subreport is not displayed. I have also set the "Connection type" property to the "Use a connection expression" and "Connection expression" to "$P{REPORT_CONNECTION}" for the subreport element. The subreport contains now only a static text field. Still, the subreport is not displayed at all inside the main report. Since, I have ran out of clues, I am also posting the xmls of the main report and subreport here, maybe someone can spot what I did wrong. Code:--main report<?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="MainReport" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20"> <property name="ireport.zoom" value="1.0"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="0"/> <parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false"> <defaultValueExpression><![CDATA["/home/ccioriia/workspace-sts/webstat2/backend/services/restFacade/src/test/resources/"]]></defaultValueExpression> </parameter> <queryString> <![CDATA[select 1]]> </queryString> <field name="lastName" class="java.lang.String"> <fieldDescription><![CDATA[lastName]]></fieldDescription> </field> <background> <band splitType="Stretch"/> </background> <title> <band height="79" splitType="Stretch"> <staticText> <reportElement x="330" y="24" width="100" height="20"/> <textElement/> <text><![CDATA[static text]]></text> </staticText> </band> </title> <pageHeader> <band height="94" splitType="Stretch"/> </pageHeader> <columnHeader> <band height="98" splitType="Stretch"/> </columnHeader> <detail> <band height="58" splitType="Stretch"> <staticText> <reportElement x="369" y="20" width="100" height="20"/> <textElement/> <text><![CDATA[static text]]></text> </staticText> </band> </detail> <columnFooter> <band height="26" splitType="Stretch"/> </columnFooter> <pageFooter> <band splitType="Stretch"/> </pageFooter> <summary> <band height="87" splitType="Stretch"> <subreport isUsingCache="true"> <reportElement x="97" y="12" width="100" height="48" isPrintWhenDetailOverflows="true" backcolor="#FFFFFF"/> <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression> <subreportExpression class="java.lang.String"><![CDATA[$P{SUBREPORT_DIR} + "SubReport2.jasper"]]></subreportExpression> </subreport> </band> </summary></jasperReport>--subreport<?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="SubReport2" language="groovy" pageWidth="270" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="270" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0"> <property name="ireport.zoom" value="1.0"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="0"/> <field name="firstName" class="java.lang.String"> <fieldDescription><![CDATA[firstName]]></fieldDescription> </field> <background> <band splitType="Stretch"/> </background> <detail> <band height="22" splitType="Stretch"> <staticText> <reportElement x="0" y="0" width="100" height="20"/> <textElement/> <text><![CDATA[dfg]]></text> </staticText> </band> </detail></jasperReport>
  6. Hello guys and Happy New Year. I want to put several independent reports into one big report. Basically, I have 2 reports, Visits and Pages and i want to create a big report VisitsPages which contains both the visits and the pages. The only thing the two reports have in common is the time range for which the report is generated. What I found using google is how to create subreports that are related to the master report, but what I want to do is to use for each subreport each own datasource without relying on data from the master report(except for the time period of course). What I did using iReport Designer 3.7.6 was: 1) create a subreport and preview the report(using the JavaBean test connection/datasource provided by iReport). I can see data when previewing the subreport as an independent report. 2) create the master report and add a subreport element to the main subreport in the detail section. The Connection type property for the subreport is "Don't pass data". The "When No Data" property for the master report is "All Sections, No details". When I try to preview the main report an empty page appears. Another important aspect would be that I am planning on using the master report jrxml file from Java to compile it and then use JasperFillManager to create a jsperprint so how could I pass the datasources needed for the subreports to the fill manager? Any help would be great. Thanks. Post Edited by cristic83 at 01/05/2011 11:12 Post Edited by cristic83 at 01/05/2011 11:19
  7. I managed to make it work by putting the chart in teh summary section of the report, instead of the detail section.
  8. Hello, I have tried to use JasperReports and followed the tutorials on the project website,but I'he ran into problems when trying to create a report which contains charts and uses XML datasource files for filling the report. I am trying to create a report that contains a chart and is using an XML datasource to fill the report, but when the report is generated one chart is generated for every record from my XML datasource. The steps I took using iReport Designer 3.7.6 were: 1) Create an empty report 2) Add an XML datasource to the report. The query language I selected is XPath, the record node: /genericSingleReport/data/data and the fields were: count and timestamp. The XML datasource file looks like this: <genericSingleReport> <data> <data> <count>388.0</count> <timestamp>1288864800000</timestamp> </data> </data> </genericSingleReport> 3) I added a BArChart(or Pie Chart or XY chart) to the detail section of the report , selected the main report dataset in the first step in the wizard, the the value: DateFormat.getDateInstance().format(new Date(Long.valueOf($F{timestamp}))) for the Category expression and: Double.valueOf($F{count}) for the value expression When I preview the report I get as many charts as data records in the XML datasource file and each chart represent the first entry in the XML file, so I have n entries for the 388 value in hte above example. This, of course, is not what I need, because I want one chart which displays all the values. Thanks for your help, Cristi
×
×
  • Create New...