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

Recursive parameter substitution.


ejhellerattc

Recommended Posts

I am generating a report using iReports 4.1.3. I am posting here because I think this is a JasperReports quesiton not a design question.

The report will eventually run from an application via the JR library. However, for development purposes, I use iReports. A parameter will be passed in for the SQL query statement. In that statement will be other parameters that need to be substituted. For development purposes, I set the default value of the query as shown in the attached code. My understanding is that parameters are recursively substituted until resolved. So if there are 2 parameters (P1 and  P2 ) and P2 is defined based on P1, should I be able to set up the parameter definitions as:

<parameter name="P1" class="java.lang.String"/>

<parameter name="P2" class="java.lang.String"/>

<queryString><!CDATA[$P!{P2}]]</queryString>

where P2 is passed in as a string that contains references to P1 (using $P!{p1} )?

If I run the code attached, I am prompted for "StartDate", then the diagnostic as shown below is displayed.

Thoughts?

Thanks,
Edward.


 

 

Code:
Error filling print... Error evaluating expression :      Source text : "select det_id as det_id1, min(archive_date) as date_1 from dbo.detector_archive da2 \ where (da2.archive_date >= $P!{StartDate}) \ and (da2.archive_date < $P!{StartDate}+86400000) \ group by det_id \ order by det_id1" net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :      Source text : "select det_id as det_id1, min(archive_date) as date_1 from dbo.detector_archive da2 \ where (da2.archive_date >= $P!{StartDate}) \ and (da2.archive_date < $P!{StartDate}+86400000) \ group by det_id \ order by det_id1"      at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:203)      at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:591)      at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:559)      at net.sf.jasperreports.engine.fill.JRFillDataset.setFillParameterValues(JRFillDataset.java:660)      at net.sf.jasperreports.engine.fill.JRFillDataset.setParameterValues(JRFillDataset.java:603)      at net.sf.jasperreports.engine.fill.JRBaseFiller.setParameters(JRBaseFiller.java:1158)      at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:802)      at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:746)      at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:58)      at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:417)      at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:247)      at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:879)      at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)      at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)  Caused by: groovy.lang.MissingPropertyException: No such property: P for class: Test_1323723556036_103013      at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:49)      at org.codehaus.groovy.runtime.callsite.GetEffectivePogoPropertySite.getProperty(GetEffectivePogoPropertySite.java:86)      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:239)      at Test_1323723556036_103013.evaluate(calculator_Test_1323723556036_103013:139)      at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:190)      ... 13 more 
Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...