Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Trouble with Persistent Variables
chorton
Fighting the urge to vent a little.
This is what I have in the initialize method of the report.
reportContext.setPersistentGlobalVariable("BeginningBalance", 5);
This is what I have in the onCreate method of a label element.
reportContext.getPersistentGlobalVariable("BeginningBalance");
Doesn't work.
Find more posts tagged with
Comments
mwilliams
Hi chorton,
Try reportContext.setPersistentGlobalVariable("BeginningBalance", "5"); The PGV takes in strings. You'll have to convert integers to strings to put them in it. When you get them out and want to compute with them, you'll need to parse them into integers.
chorton
That worked my bad.
Now that I'm over that..
Are there any articles or documentation about how to assign a value from a database to a PGV.
I have a dataset which just contains a clientID and a beginningBalance.
I need to get the beginning balance into a variable so I can add or subtract from it later in the report.
mwilliams
chorton,
You should just be able to grab the row["columnName"] value in your onFetch method of your dataSet and assign it to a PGV. Then, you should be able to recall this value later in your report. You'll just have to make sure that a report element in your report, above where the PGV is being recalled, is tied to the dataSet in which the PGV is set so that the onFetch script is called.
jain
Hi, I have developed a bar chart report using BIRT3.7 and I am facing a problem in setting the persistenceGlobalVariable, have created two datasets dataset1 and dataset2. I have set the dataset2 column field value as persistenceGlobalVariable and accessed the PGV variable inside the chart scripting, but thing is every time when I access the PGV value I am getting the last set value from the dataset2 column. How do I set the PGV so that I can retrieve the correct value from the dataset.
mwilliams
If you're setting the persistentGlobalVariable in your dataSet script and only have a single PGV, you'll always get the last value. Depending on what you're trying to do, you could create PGVs with dynamic names or store your values in an array, then pass them through your PGV.