kunkasurendra Posted August 13, 2007 Share Posted August 13, 2007 Hai All, I am facing the problem while doing the formulas. i want to execute the if ... else statement using formulas. I am using oracle. Here i have the database column with data type BigDecimal column name : ACT_DURATION Datatype : BigDecimal In iReport i created one variable named as planedDuration with variable class type is BigDecimal Then in Report i created one text field. In that i want to validate the expression using formulas. means if planedDuration is < 1 then it wants to display the "<1 day" or planedDuration is > 1day it wants to display the no of days. Code:( new BigDecimal(($V{planedDuration}.intValue()) /(24)) < 1 ? "<1 DAY" : new BigDecimal(($V{planedDuration}.intValue()) /(24))+" DAYS" ) here i am getting error. The operator < is undifined for the argument type(s) BegDecimal,int please any one help me, it's very urjant, Thanks in advance, Surendra Babu.k. Link to comment Share on other sites More sharing options...
nittu02 Posted August 13, 2007 Share Posted August 13, 2007 Your print when expression should be something like this:Code:new Boolean(($V{planedDuration}.intValue()) /(24) < 1 ? "<1 DAY" : ($V{planedDuration}.intValue()) /(24)+" DAYS" ) Link to comment Share on other sites More sharing options...
nittu02 Posted August 13, 2007 Share Posted August 13, 2007 am sorry, you are printing a String right? depending on the condition. So you just need to put this as the expression, and set the type to String:Code:new String($V{planedDuration}.intValue()/24<1?"1 DAY":$V{planedDuration}.intValue()/24+" Days"«») Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now