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

How to calculate the average and give the output in a textfield? (Jaspersoft Studio)


finn.hoffmeister

Recommended Posts

Hi there,

 

I have a table in my database, that shows different values for each month. So I created a chart showing that and I now am trying to implement a textfield that says "average value of the last 12 month: And than the average".

So I have been doing some research and it seems like I have to create a Variable, which I did. 

I named the Variable, changed the Value Class Name to java.lang.integer, chose Average for the Calculation option and set the expression to $F{value} (which is the name of the value-table.)

When I am trying to drag the Variable into my report, it will only show "null" in the preview.

Does anyone know what to do / has a well written instruction for this?

Thank you!

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

It seems the problem caused by reset type of variable and evaluation time of the textfield which holds the variable.

check the reset type of variable. It shoud be 'report'. Evaluation type is 'Now' as default. It differs according the usage of textfield. For example if you use text field in a group header, you should change the evaluatin time should be 'Group'

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