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)
Store DataSet values in a 2-D JavaScript array
nishu2587
I have a dataset in my BIRT report which gets some data from MySql DB.
I need to store all this data in a 2-D JavaScript array, so that I can use it to create another table by modifying this data.
Please guide me how to do this.
Find more posts tagged with
Comments
kclark
I usually use an ArrayList when I'm getting data from the dataset. To do this you need to place this code in the beforeOpen()<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
var array = new java.util.ArrayList();
reportContext.setPersistentGlobalVariable("array", array);</pre>
<br />
And then to store the values you'd use some script like this from the onFetch()<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
var array = reportContext.getPersistentGlobalVariable("array");
array.add(row["AMOUNT"]);
reportContext.setPersistentGlobalVariable("array", array);</pre>
<br />
to recall the values in a label you can do something like this from the onCreate()<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
var array = reportContext.getPersistentGlobalVariable("array");
this.text = array.get(0);</pre>