0
votes

I have a Birt Report which read some stuff from a database. After that i want to increment a global Integer for every Detailrow that is loaded. So far i have initialized a global Integer with the following lines:

importPackage(Packages.java.lang);
reportContext.setPersistentGlobalVariable("minTotalPlus", new Integer(0));

After that i added the following line into a field in my detail row:

reportContext.setGlobalVariable("minTotalPlus",  new Integer reportContext.getGlobalVariable("minTotalPlus")) + 1);

When i preview the report i get an "java.lang.NumberFormatException: null" which means that the global variable is null. Why is that so? How could I fix that?

1
In your second snippet of code above, you call "setGlobalVariable". This is not a valid BIRT scripting method. Is this an error in the post or possibly an error on the report contributing to the issues you are seeing. I have some ideas here but I wanted to clear tht up before proceeding. - MystikSpiral
Hi there! Thanks for your answer. I found out that you can define a global variable very easily by just adding "minTotalPlus = new Integer(0);" to the initialize event of your report. So I dont need the code above anymore. - Matschie

1 Answers

0
votes

Dont' declare variables like that in the initialize method declare the like the following

materiales=0;
tools=0;

then in the fetch method use the following

tools++;

...etc.