How to perform subtraction between Text Field and Variable

0

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(JREvaluator.java:327)      at net.sf.jasperreports.engine.fill.JRCalculator.evaluateEstimated(JRCalculator.java:602)      at net.sf.jasperreports.engine.fill.JRCalculator.estimateVariables(JRCalculator.java:201)      at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:1261)      at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:1235)      at net.sf.jasperreports.engine.fill.JRBaseFiller.next(JRBaseFiller.java:1614)      at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:150)      at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:963)      at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:873)      at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:87)      at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:287)      at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:760)      at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:891)      at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)      at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)  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(ScriptBytecodeAdapter.java:55)      at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46)      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)      at report7_1451461184747_723585.evaluateEstimated(calculator_report7_1451461184747_723585:564)      at net.sf.jasperreports.engine.fill.JREvaluator.evaluateEstimated(JREvaluator.java:314)      ... 14 more 

anwarzamal2000's picture
Joined: Dec 8 2015 - 10:21pm
Last seen: 3 years 10 months ago

 

 

 

anwarzamal2000 - 3 years 10 months ago

3 Answers:

1

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
541
Joined: Nov 19 2014 - 11:02pm
Last seen: 3 years 4 months ago
0

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: 3 years 10 months ago
0

class is the datatype.

hozawa's picture
53042
Joined: Apr 24 2010 - 4:31pm
Last seen: 5 months 1 week ago
Feedback
randomness