Jump to content
Changes to the Jaspersoft community edition download ×

Using two fields in a variable expression


2004 IR Help

Recommended Posts

By: tuckettt - tuckettt

Using two fields in a variable expression

2005-05-09 08:39

How do I create a variable that has a calculation of two doubles. It would look something like this:

 

($F{ss_hours_scheduled} - $F{ss_hours_worked}) / $F{ss_hours_scheduled})

 

The error I get is that I cannot use the '-' operator with a Double, Double.

 

Any ideas?

 

 

 

 

By: Brent - bwenson

RE: Using two fields in a variable expression

2005-05-09 08:45

Cast them to doubles then back to a Double...

 

new Double( ( $F{ss_hours_scheduled}.doubleValue() - $F{ss_hours_worked}.doubleValue() ) / $F{ss_hours_scheduled} )

 

I don't remember off the top of my head but you might have to case the fields like this:

 

((Double)$F{ss_hours_scheduled}).doubleValue()

 

I don't think you have to do that, but in case you do there it is.

 

 

 

 

By: Brent - bwenson

RE: Using two fields in a variable expression

2005-05-09 08:46

Oops...slight error...forgot to cast the last one...

 

new Double( ( $F{ss_hours_scheduled}.doubleValue() - $F{ss_hours_worked}.doubleValue() ) / $F{ss_hours_scheduled}.doubleValue() )

Link to comment
Share on other sites

  • Replies 0
  • 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...