finn.hoffmeister Posted September 16, 2015 Posted September 16, 2015 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!
carlos2015 Posted September 16, 2015 Posted September 16, 2015 Strange, make sure the variable is defined like this: <variable calculation="Average" class="java.lang.Long" name="AverageMonth"> <variableexpression><!--[CDATA[$F{value}]]--></variableexpression> </variable>[/code]
finn.hoffmeister Posted September 17, 2015 Author Posted September 17, 2015 Hey,I have the same definition but unfortunately it still shows "null"...I have tried to create a subreport and somehow it worked there, but when I am trying to preview everything in the original Report, nothing will show up at all, not even a "null".Do you have an idea how why this might be? :D
zh3ntil Posted September 17, 2015 Posted September 17, 2015 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'
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now