How to perform subtraction between Text Field and Variable

I am very new with ireport-5.6.0.How can i solve this problem.Please any one help me

I have one text field(Sanctioned_intake) and one i declare variable(ROPORT_COUNT).Sanctioned_intake is nothing but total number of Student per Department and REPORT_COUNT is return total no of rows which is enter into the report

For Example:

Sanctioned Intake:140 (Total Student per Department)

Actual Admitted: 10 (Actual Admission Taking)

So Difference Should Be:

Vacancy : 130(Remaining Vacancy )

now my question is how to make difference between this two

I declare One Variable

and set the following properties

variable class=java.math.BigDecimal
Calculation Sum
Reset Type Report
Variable Expression: $F{sanctioned_intake}.substract($V{REPORT_COUNT})

but i got this error

Error filling print... Error evaluating expression :      Source text : $F{sanctioned_intake}.substract$V{REPORT_COUNT} net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :      Source text : $F{sanctioned_intake}.substract$V{REPORT_COUNT}      at net.sf.jasperreports.engine.fill.JREvaluator.evaluateEstimated(      at net.sf.jasperreports.engine.fill.JRCalculator.evaluateEstimated(      at net.sf.jasperreports.engine.fill.JRCalculator.estimateVariables(      at      at      at      at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(      at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(      at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(      at net.sf.jasperreports.engine.fill.JRFiller.fill(      at net.sf.jasperreports.engine.JasperFillManager.fill(      at net.sf.jasperreports.engine.JasperFillManager.fillReport(      at      at org.openide.util.RequestProcessor$      at org.openide.util.RequestProcessor$  Caused by: groovy.lang.MissingMethodException: No signature of method: java.lang.String.substract() is applicable for argument types: (java.lang.Integer) values: [1] Possible solutions: substring(int), substring(int, int)      at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(      at      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(      at      at      at report7_1451461184747_723585.evaluateEstimated(calculator_report7_1451461184747_723585:564)      at net.sf.jasperreports.engine.fill.JREvaluator.evaluateEstimated(      ... 14 more 

anwarzamal2000's picture
Joined: Dec 8 2015 - 10:21pm
Last seen: 7 years 1 month ago




anwarzamal2000 - 7 years 1 month ago

3 Answers:

Caused by: groovy.lang.MissingMethodException: No signature of method: java.lang.String.substract()

you are trying to substract and integer from string. That's not possible :) you should check the fields type.

zh3ntil's picture
Joined: Nov 19 2014 - 11:02pm
Last seen: 6 years 6 months ago

But how can i check the fields type. ,In xml  field name and class is given. field type is not there how can i checked this?i tryed to change both class type class = "java.math.BigDecimal" and the variable which i declare to take difference also keep class type="java.math.BigDecimal" after then i got null value








anwarzamal2000's picture
Joined: Dec 8 2015 - 10:21pm
Last seen: 7 years 1 month ago

class is the datatype.

hozawa's picture
Joined: Apr 24 2010 - 4:31pm
Last seen: 3 years 7 months ago