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

Dividing variables in a text field.


michael.edstrom1

Recommended Posts

So, I'm currently working on a report in iReport 5.6.0.

I'm having a problem with a calculation in a textfield.

Language in file: Groovy.

Variable = java.lang.Double

So I'm getting the price of a product from a field, we can call it: $F{x_x}, this field is a string, but contains only numbers(double) like this, "540,00".

What I wan't to do now is first get some code to check for empty fields or nulls, which I do like this: ($F{x_x} == null || $F{x_x} == " ") ? "" :    <--- so far so good.
What needs to happen now is to take the string that's inside the field(if you pass the first statement) and make this string into a number(double I assume) and then divide it with 0,9.

I've found some possible solutions for this in other threads and also tried some of my own but it just doesn't want to work. I just get errors regarding that specific code won't work(in iReport), and the pdf won't open obviously.

Suggestions on a solution for this? Thanks in advance.

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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