Jump to content

swarm357

Members
  • Posts

    14
  • Joined

  • Last visited

 Content Type 

Forum

Downloads

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Security Advisories

Events

Profiles

Posts posted by swarm357

  1. Hi All,

    I just finished wrestling with putting together a report with 4 sub reports. Some key things I found where:

    1.     make sure all your subreports have the proper height
    subreport height (max height allowed) = master report height - master report page header band height - master report page footer band height - master report top margin - master report bottom marge

    2.     if you have an image in the master report header/footer band make sure you have the right "Scale Image" setting. I had the image in my page header set to 'scale image' = 'retain shape' which apparently cause the page header to be larger that the size I allotted it (100px). Once I change the 'scale image' setting to 'fill frame' that solved my issue. feel free to experiment with the other possible 'scale image' setting.

    3.     In the master report summary band space your subreports with page breaks between like below. please note that the subreports dont need to have actual height spelled out in the master report, but I found it easer to make the widths correspond exactly.

    ·       subreport1 (top = 0, height = 30)

    ·       page break (top = 31, height = 1)

    ·       subreport2 (top = 32, height = 30)

    ·       page break (top = 63, height = 1)

    ·       etc ...

     

     

     

  2. I have discovered that when i make a new report master report from scratch and add the subreport then my new master report works just as it should. What might be causing an already existing (complex) report to not accept an addition of a component that requires a data source expression value? i just ran into this same issue when i tried to change the data source for some charts in the summary section of my master report. I was trying to have them use a new sub dataset which contains the exact same fields as the master dataset.
  3. Hey all,

    Im working on a MacBook Pro with Mountain Lion and the 5.0.1 version of Jaspersoft iReport Designer .... i have tried to work around this on my pc as well with the same result (iReport 5.0.1 as well on pc)

    I have read through many other questions/answers in the answer section and im rather stumped with my current issue. I have a master report (Standard Report 1) that i am adding a subreport into. The subreport is valid/works when i preview it. In the master report I have set the subreport data source expression to:

    ((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).dataSource("/page/view2/row")

    which i Know works b/c i used the exact same expression with a different valid string for the dataSource method in 7 other reports.

    Standard Report 2 subreport jrxml snippet - this is a report which is currently working

     

    $P{nullText}
    $P{chartThreeName}
    $P{chartOneName}
    $P{chartTwoName}
    $P{nullText}
    ((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).dataSource("/page/view1/row")
    $P{SUBREPORT_DIR} + "standard_report_2_chart_subreport_dev.jasper"
    Here is the snippet of my Standard Report 1 - which is Not working
     
    ((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).dataSource("/page/view2/row")
    $P{SUBREPORT_DIR} + "standard_report_1_subreport_dev.jasper"
     
    note that the dataSourceExpressions are EXACTLY the same minus the slightly different string in the dataSource method

    However, when i try to run the master report (Standard Report 1) i see the following:

    Error filling print... Error evaluating expression : 
        Source text : ''net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).dataSource'"/page/view2/row")

    net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression : 
        Source text : ''net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).dataSource'"/page/view2/row")
        at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:203)
        .... etc ....

    my question is why are my leading parentheses being, apparently, converted to single quote characters ?????

    Has anyone else run into this issue? Or found a solution/workaround?

    Thanks for you help in advance!

  4. Im using iReport 5.0.0, jasperreports 4.7.1 and eclispe indigo. My objective is to use iReports to create the jrxml files and then use some java to populate my reports with the data that my clients will provide me at run time. When i try to use my ReportGenRunner.java class to execute my ReportGenerator.run() method i get the follow exception:

     

    net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
    org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
    calculator_Report1_1355934859559_852911: 225: unexpected char: '' @ line 225, column 24.
    1 error
     
    at net.sf.jasperreports.compilers.JRGroovyCompiler.compileUnits(JRGroovyCompiler.java:113)
    at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:201)
    at net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:240)
    at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:496)
    at com.ahsrcm.mobidash.jasper.java.reports.ReportGenerator.run(ReportGenerator.java:83)
    at com.ahsrcm.mobidash.jasper.java.reports.runners.ReportGenRunner.main(ReportGenRunner.java:36)
    Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
    calculator_Report1_1355934859559_852911: 225: unexpected char: '' @ line 225, column 24.
    1 error
     
    at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:296)
    at org.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollector.java:143)
    at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:113)
    at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:125)
    at org.codehaus.groovy.control.SourceUnit.addError(SourceUnit.java:337)
    at org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:99)
    at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:71)
    at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:236)
    at org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:158)
    at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:814)
    at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:511)
    at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:487)
    at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:464)
    at net.sf.jasperreports.compilers.JRGroovyCompiler.compileUnits(JRGroovyCompiler.java:109)
    ... 5 more

    I have been reading various related forums about what might cause this exception to be thrown and i have made changes to all my reports expressions so that any time a field/parameter/variables are converted into int or double primitive types.

    The thing that is really confusing me is that line 225, column 24 does not contain an experssion in my jrxml. It is the end of one of my conditional style nodes. i have included the section of my jrxml that contains line 225

     

    ...
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223 new java.lang.Boolean($V{REPORT_COUNT}.intValue()%2 == 1 && $F{ESIBOV__sum}.doubleValue() < 0.0)
    224
    225
    226
    227 new java.lang.Boolean($V{REPORT_COUNT}.intValue()%2 == 0 && $F{ESIBOV__sum}.doubleValue() < 0.0)
    228
    229
    230
    231 new java.lang.Boolean($V{REPORT_COUNT}.intValue()%2 == 0)
    232
    233
    234
    ...

    here is the method (run() ) that is where i try to use java to compile my report. the variables with '_' before them are my variables that i initalize in my ReportGenerator.java constructor.

     

    Note: i do make changes to the jrxml using the java api, however my changes are not anywhere near where the exception is being throw. the report im running this code on has no subreports and i have triple checked that my images are in the right location and that the path string i use to find them are valid.

     

    public void run() {
    _logger.debug("pdf will be at: " + _pdfFileLoc);
    try{
    JasperDesign design = JRXmlLoader.load(_jrxmlLoc);
    JRDesignQuery query = new JRDesignQuery();
    String initialMaseterQuery = design.getQuery().getText();
    query.setText(_xPathQuery);
    design.setQuery(query);
     
    // sets all subreports data sources to the same as the master report
    for ( JRBand jrb : design.getAllBands()) {
     
    for (JRChild jrc : jrb.getChildren()) {
    if (jrc instanceof JRDesignSubreport) {
    JRDesignSubreport jrds = (JRDesignSubreport)jrc; 
    String initialQuery = jrds.getDataSourceExpression().getText();
    if ( initialMaseterQuery == initialQuery) {
    JRDesignExpression jrde = new JRDesignExpression("((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).dataSource(" + _xPathQuery + ")");
    jrds.setDataSourceExpression(jrde);
    _logger.warn("JRDesignSubreport now has datasource expression: " + jrde.getText());
    } else {
    throw new RuntimeException("subreport has different query than master report ... implement me!");
    }
    } else if (jrc instanceof JRDesignImage) {
    JRDesignImage image = (JRDesignImage) jrc;
     
    JRDesignExpression jre = new JRDesignExpression(_imageDir + "\" + getImageName(image));
    image.setExpression(jre);
    _logger.debug("image's new expression=" + image.getExpression().getText());
    }
    }
    }
     
     
    _logger.debug("compiling JasperReport");
    JasperReport report = JasperCompileManager.compileReport(design);
     
    JRXmlDataSource dataSource = new JRXmlDataSource(_xmlDataLoc);
     
    _logger.debug("filling JasperPrint");
    JasperPrint print = JasperFillManager.fillReport(report, _parms, dataSource);
    JasperExportManager.exportReportToPdfFile(print, _pdfFileLoc + pdfName() );
     
    } catch (JRException jre) { 
    jre.printStackTrace();
    }
    }
     
    I have tired to use the depeciated JRJdtCompiler in place of JasperCompileManager and that did not work.

    Does anyone have any ideas as to why this exception is being thrown where it is? has anyone else had a similiar issue with trying to compile jrxml that they have generated using iReport?

    Thanks in advance or your input/solutions!

     

     

  5. A shorter way to do cjasper's solution is something like this:

     

    public class MyCustomizer implements JRChartCustomizer {

     

    @Override

    public void customize(JFreeChart chart, JRChart jasperChart) {

    NumberAxis numAxis = (NumberAxis) chart.getCategoryPlot().getRangeAxis();

    numAxis.setNumberFormatOverride(new DecimalFormat("#,##0"));

    }

    }

×
×
  • Create New...