Jump to content
Changes to the Jaspersoft community edition download ×

getting error while doing formulas if ...... else


kunkasurendra

Recommended Posts

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

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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

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