I just ran into a situation where I declared a global array, populated it in the Detail section of the report, but when I tried to reference it in a different formula field in the Report Footer section it was empty!
Is this a bug, or a feature?
FWIW, changing the declarations to Shared fixed this issue. This was the only change to the code.
Here's a tip, which I used to verify that the array was in fact getting cleared when referenced in the Report Footer section:
In the Detail section formula field that populated the array, I added the following (Basic syntax)
dim debug as number global dbgcnt as number dbgcnt = dbgcnt + 1 if dbgcnt > 100 then debug = debug / debug end if
This causes a divide by zero error on the 101st detail record, which brings up the formula editor and displays the values of all of the variables. I could see the arrays were populated.
I then commented the above out, and in the Report Footer section, I added
dim debug as number debug = debug / debug
To see that the arrays had no data in them.
I find this to be a great way to debug a report. Hope you like it! 😊
HTH,
Carl