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

String to Double in a field expression...


gi-spot

Recommended Posts

I solved my main trouble. Now the last one: I have a string which represents a number (cost of a component). I need to use this cost for calculating something else. How can I convert a string to double for using in a textfield expression?

Thank you all....

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic


Thanks a lot: I'm beginning to understand something about. Expression you posted to me seemed to work fine in ireport, but when I try to compile the report in "invoicex" it returns to me the error:

net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression: Source text: new Double(Double.parseDouble($F{importo})).

Procession Timing? A "null" string? Any idea? I'm going slightly mad...but thanks in advance to everybody will help me.
 



Post Edited by gi-spot at 05/10/2011 20:02
Link to comment
Share on other sites

You can use short-hand conditional statement.

SYNTAX:

( <condition> ? exp1 : exp2 )

 

variable will return exp1 if condition is true, else exp2 will be returned.

it is like

if(<condition>)

{

exp1

}

else

{

exp2

}

 

GoodLuck

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