I have some variables/constants that I'd like to define globally for reference throughout my report.
Eg., KBDivisor=1024
I tried:
reportContext.setPersistentGlobalVariable("KDivisor", "1024");
in the initialize method of the report.
But when I try to access this value in say an aggregation expression in a table:
dataSetRow["maxMemory"]/parseInt(reportContext.getPersistentGlobalVariable( "KBDivisor"));
I don't get any value back.
What is the trick I am missing here and is there a better best practice way to achieve what I am attempting.
Are you doing this on the dataset or in an aggregation element in the
report?
Jason
On 2/4/2011 9:41 AM, Mike Wulkan wrote:
> I have some variables/constants that I'd like to define globally for
> reference throughout my report.
>
> Eg., KBDivisor=1024
>
> I tried:
> reportContext.setPersistentGlobalVariable("KDivisor", "1024"); in the
> initialize method of the report.
>
> But when I try to access this value in say an aggregation expression in
> a table:
> dataSetRow["maxMemory"]/parseInt(reportContext.getPersistentGlobalVariable(
> "KBDivisor"));
> I don't get any value back.
>
> What is the trick I am missing here and is there a better best practice
> way to achieve what I am attempting.
Thanks, that is what I had with one exception. I had some functions defined in the report initialize exit and had placed the setting of the global variable after the functions. When I moved it to before the functions it worked.
Is that expected?
initialize exit? Can you post in a sample what was failing?
On 2/4/2011 11:22 AM, Mike Wulkan wrote:
> Thanks, that is what I had with one exception. I had some functions
> defined in the report initialize exit and had placed the setting of the
> global variable after the functions. When I moved it to before the
> functions it worked.
> Is that expected?