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

Calcualte a field with java code


javydreamercsw

Recommended Posts

I want to display a result based on a Java function, which I'm coding right now, that'll take to fields ($F{Field1} & $F{Field2}) that are dates and get the amount of working days betweem them. How can I make this calculation in the report and post the answer?

 

I'll post the function code when I'm done.

Link to comment
Share on other sites

  • Replies 12
  • Created
  • Last Reply

Top Posters In This Topic

I managed to pull out the calcualted code thanks to lucianc but found another dilema tha I hope you can help me with.

The function works great but I need to calculate de average of it to be displayed in my report. So I've added a sum variable on the field. So I tried to do something like this to get the average:

Code:

But it gives me errors:

 

Code:

How can I get the average?

Thanks in advance...

 

 

Link to comment
Share on other sites

That's exactly what I'm attempting to do. I need to know how I actually pass the variable. Is there an special variable setting? WHere I decide which variable is passed?

 

Because when I try to get the returned value from the main report (subreport Properties/Subreport (Others)/Subreport Return Values) the only available variable in the list are the automatically generated *_Count variables.

Link to comment
Share on other sites

use some thing like this for ur problem......

new Long(($V{variable1}.longValue)/($V{variable2}.longValue))

 

i think this way ur problem will be resolved. Use actual dataType that ur using instead of Long.

I think now u can understand what are i am doing.

B'coz u can not use division on two objects of Wraper Type.

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