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

How to perform subtraction between Text Field and Variable


anwarzamal2000

Recommended Posts

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 

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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

 
 

 

 

 

 

 

 

Link to comment
Share on other sites

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...