我正在使用( gasp )startDate
和endDate
参数构建报告。 我想在报告中显示这些参数。我尝试过使用
$P{startDate}
"Text"+$P{startDate}
DATEFORMAT($P{startDate},"yyyy-MM-dd HH:mm:ss")
但是在每次预览尝试中,我都会收到net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :
错误。
我确定我错过了一些简单的事情......
答案 0 :(得分:0)
RTFStackTrace。
net.sf.jasperreports.engine.JRException: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :
Source text : DATEFORMAT($P{startDate},"yyyy-MM-dd HH:mm:ss")
at com.jaspersoft.studio.editor.preview.view.control.ReportControler.fillReport(ReportControler.java:467)
at com.jaspersoft.studio.editor.preview.view.control.ReportControler.access$18(ReportControler.java:442)
at com.jaspersoft.studio.editor.preview.view.control.ReportControler$4.run(ReportControler.java:334)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :
Source text : DATEFORMAT($P{startDate},"yyyy-MM-dd HH:mm:ss")
at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:263)
at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:611)
at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:579)
at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:1016)
at net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText(JRFillTextField.java:573)
at net.sf.jasperreports.engine.fill.JRFillTextField.evaluate(JRFillTextField.java:557)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:259)
at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:455)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillBandNoOverflow(JRVerticalFiller.java:433)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillPageHeader(JRVerticalFiller.java:397)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:258)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:124)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:540)
at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFill.run(BaseFillHandle.java:120)
at java.lang.Thread.run(Thread.java:695)
Caused by: java.lang.ClassCastException: java.util.Date cannot be cast to java.sql.Date
at MyReportName_282540.evaluate(MyReportName_282540:245)
at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:250)
... 14 more
注意:java.util.Date cannot be cast to java.sql.Date
将“{1}}”中的“类”选项更改为java.sql.Date
(由an answer elsewhere暗示)让报告运行并显示值(对于上面的每个项目符号)。
我保证在此Q& A之前有很多java.util.Date
。由此我猜测internet | grep
形式的util
是参数的首选。