Jump to content

problem with variables in java aplication


daseparo

Recommended Posts

Hi,

i create report with some calculations in scriplet. When i run report in iReport 2.0.4 everything is ok, variable calculation is perfect. But, when i run report from java application it shows me only variable initial value. It looks like my calculation in scriplet is not working, (or app only shows initial value of variable) but my return value is showing in some other field where is required.

 

Please if anyone knows what can be problem. I even try first to compile report in java application, and compiler, and execution of application didn't throw any warning,exception or error.

 

 

Here is example of my scriplet code.

 

Code:

public class kupovinaScriptlet extends JRAbstractScriptlet {

/** Creates a new instance of JRIreportDefaultScriptlet */
public kupovinaScriptlet() {


}


public String popuni() throws JRScriptletException
{

java.lang.Long tr=(java.lang.Long)getFieldValue("transbaza_RBRKupca"«»);
java.lang.Long br=(java.lang.Long)getParameterValue("parametar"«»);
java.lang.Long stanje=(java.lang.Long)getVariableValue("temp"«»);
java.lang.Long iznos=(java.lang.Long)getFieldValue("transbaza_IznosTransakcije"«»);

if(tr==br)
{
//java.lang.Long rez=stanje+iznos;
this.setVariableValue(temp,stanje+iznos);
return "+" ;
}
else
{

//java.lang.Long rez=stanje-iznos;
this.setVariableValue(temp,stanje-iznos);
return "-";
}
}
Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

this is really wired, are you sure you are not deploying an old version of the scriptlet?

 

Why don't try to add some System.out.println() to the scriptlet to see what's going on?

 

Are you using in your app the same jasperreports version shipped with iReport? (just in case, this is not a requirement usually).

 

Giulio

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