Home
Analytics
defining and accessing global variable and functions in BIRT report onRender()
Mani Kandan
<p style="font-size:15px;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;">I am using crosstab for my report to show my detail row vertically. I need to generate column names as in the excelsheet, so when showing in webviewer the data element(computed columns) will be showed but when export to excel i need to set its value by this.setDisplayValue(), the value will be the excel names which is generated dynamically based on the count. I am generating column count by initialize a count variable in report initialize() event, and in a data element onRender() event this count value is incremented.This is done for only one time(to get the dataset rowcount). </p>
<p style="font-size:15px;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;">I need to create a global array variable and a function, so that for every increment, i will pass the value to the function this function will return the excel names for the number it received as param, and then the array variable will be populated with the number and its excel names(1-A,2-A.....26-Z,27-AA,...etc).</p>
<p style="font-size:15px;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;"> </p>
<p style="font-size:15px;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;">How can i declare global function and a variable, so that it can be accessible for onRender event and can be populated?</p>
Find more posts tagged with
Comments
JFreeman
<p>You can use a persistent global variable:</p>
<pre class="_prettyXprint _lang-js">
reportContext.setPersistentGlobalVariable("varName", value);
reportContext.getPersistentGlobalVariable("varname");
</pre>