Jump to content
Changes to the Jaspersoft community edition download ×

How to use beforeDetailEval to set a var.


2005 IR Help

Recommended Posts

By: Neil Lamka - neil_lamka

How to use beforeDetailEval to set a var.

2005-11-30 16:05

I'm trying to put together my first scriptlet so this may be a dumb questionl

 

First, I'm assuming that the beforeDetailEval method in a scriptlet is called for each row in the returned results. Is this true?

 

What I was trying to do was to set the value of a report variable from this method call but I seem to only get null as the result.

 

In a simple test i have a global variable

 

int counter=0;

 

I then have the implementation that looks like

public void beforeDetailEval() throws JRScriptletException

{

setVariableValue("testInt", new java.lang.Integer( counter++ ));

 

}

where the variable testInt is defined as a java.lang.Integer in the report.

 

In the detail band I use $V{testInt} in the report but seem to only get null values in return.

 

Obviously I'm missing something basic here and any pointers would be helpful.

 

Thanks

Neil

 

 

 

 

By: spalazzi - spalazzi

RE: How to use beforeDetailEval to set a var.

2005-12-02 06:09

try with

this.setVariableValue("testInt", new java.lang.Integer( counter++ ));

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

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