Variables and Expressions in JasperStudio

0

Hello,

I have been working on making reports. I want to use variables for the sum of the values in the field. However, I am not able to understand how to set the appropriate expression for the variable and it is giving me the following error.

net.sf.jasperreports.engine.JRException: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: $V{TotalFreights}
at com.jaspersoft.studio.editor.preview.view.control.ReportControler.fillReport(ReportControler.java:548)
at com.jaspersoft.studio.editor.preview.view.control.ReportControler.access$20(ReportControler.java:523)
at com.jaspersoft.studio.editor.preview.view.control.ReportControler$5.run(ReportControler.java:404)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: $V{TotalFreights}
at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:290)
at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:616)
at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:584)
at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:1164)
at net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText(JRFillTextField.java:526)
at net.sf.jasperreports.engine.fill.JRFillTextField.evaluate(JRFillTextField.java:510)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:381)
at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:500)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillFixedBand(JRVerticalFiller.java:2073)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnFooter(JRVerticalFiller.java:967)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillPageBreak(JRVerticalFiller.java:1898)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBreak(JRVerticalFiller.java:1946)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:724)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:255)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:115)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:582)
at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFill.run(BaseFillHandle.java:123)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Float
at ORDERLIST1_1484312323037_882242.evaluate(ORDERLIST1_1484312323037_882242:315)
at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:276)
... 17 more

 

Please let me know from where I can learn how to use variables  and parameters in reports. I found most of the information on how to create them . I want to know where and how I can use them in the reports.

Thank you.

shivani133199699's picture
Joined: Dec 14 2016 - 4:55am
Last seen: 2 years 10 months ago

1 Answer:

0

You probably need to first study about programming in Java. The error message just states that you're trying to set Integer to a Float. To resolve this issue, you just need to make your variables and fields you're using in an expression to be of a same type. This isn't JasperReports issue but basic programming issue.

hozawa's picture
54280
Joined: Apr 24 2010 - 4:31pm
Last seen: 6 months 1 day ago
Feedback
randomness