samhast Posted February 11, 2013 Share Posted February 11, 2013 I trying to use the DateRange parameter. I followed the instructions from the iReport PDF. That's my code:I have an error when I run the report:Compilation exceptions: com.jaspersoft.ireport.designer.compiler.ErrorsCollector@91c832net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:calculator_all32op_1360591932552_649225: 131: unable to resolve class DateRangeBuilder @ line 131, column 22.calculator_all32op_1360591932552_649225: 207: unable to resolve class DateRangeBuilder @ line 207, column 22.calculator_all32op_1360591932552_649225: 283: unable to resolve class DateRangeBuilder @ line 283, column 22.3 errors 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.compileToFile(JasperCompileManager.java:156) at net.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:439) at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:528) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:calculator_all32op_1360591932552_649225: 131: unable to resolve class DateRangeBuilder @ line 131, column 22.calculator_all32op_1360591932552_649225: 207: unable to resolve class DateRangeBuilder @ line 207, column 22.calculator_all32op_1360591932552_649225: 283: unable to resolve class DateRangeBuilder @ line 283, column 22.3 errors at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:296) at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:829) 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) ... 7 more[/code] Link to comment Share on other sites More sharing options...
aiklamha1 Posted March 20, 2013 Share Posted March 20, 2013 I am having the same problem. Anyone? Link to comment Share on other sites More sharing options...
aiklamha1 Posted March 20, 2013 Share Posted March 20, 2013 Hi, I solved the problem. I changed the default expression from new DateRangeBuilder("DAY-1").toDateRange() to new net.sf.jasperreports.types.date.DateRangeBuilder("DAY-1").toDateRange() Link to comment Share on other sites More sharing options...
Solution marianol Posted March 22, 2013 Solution Share Posted March 22, 2013 Reposting aiklamha1 solution as an answer:Just change the default expression from new DateRangeBuilder("DAY-1").toDateRange() to new net.sf.jasperreports.types.date.DateRangeBuilder("DAY-1").toDateRange()Note:Remember that when using this option the parameter class has to be set to DateRange (net.sf.jasperreports.types.date.DateRange). And this parameters are not date (java.util.dates) but ranges, so if you need to print (show) them in your report in a text field and use the patterns; you can use the getStart() or getEnd() methods. for example: new net.sf.jasperreports.types.date.DateRangeBuilder("MONTH").toDateRange() $P{dateto}.getStart() Check in the iReport Ultimate Guide Chapter 6.2.4 (http://community.jaspersoft.com/documentation) for a full example. Link to comment Share on other sites More sharing options...
samhast Posted June 27, 2013 Author Share Posted June 27, 2013 Now it works! thanks! I have just one question, now my parameter have a default value expression:new net.sf.jasperreports.types.date.DateRangeBuilder("MONTH").toDateRange()Is it possible to replace "MONTH" with a parameter ? For example the user select in a list last month or last week and the value changes..Is that possible? 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