Jump to content
JasperReports Library 7.0 is now available ×

Problem with estimated variable value


homer

Recommended Posts

Hi,

 

I have a variable which hold informations to generate a graphic in the sumary band. Informations are added to the variable in the group band by a call to a static method. The variable is configured like this :

 

- Calculation type : nothing

- Reset type : group

- Reset group : graph

- Initial value = a static method call which return a default value.

- Variable expression = a static method call which use this variable and return its new value for each group value.

 

When I run the report, I have a NullPointerException when the variable expression static method is called.

 

If I understand the problem, to build the report, Jasper try to estimate the value of the variable. When it does this, it don't use the initial expression to initialize the variable and so the variable value is null and the method call failed.

 

Can you help me ? I don't know what to do.

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Hi,

 

I think you would have better control over your variable if you would just use the scriptlet functionality.

Also, the calculation type for your variable in that case would be System.

 

Sometimes is just too complicated to control a variable by only playing with its expressions, especially because the expression is evaluated more than once with every record, as you mentioned.

 

I hope this helps.

Teodor

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