Global variables are available throughout Intelligence Clients and include document and custom scripts, all Dashboard control and section scripts, the Report Designer section, the computed items features of the Results, Chart, and Pivot sections, and other BQY documents opened in the same instance of Intelligence Clients.
Global variables are not available between BQY documents when using the web client because Web browsers do not support them. Cookies should be used to write variables shared between documents. |
A global variable is defined outside of a function or event and once defined, can be accessed by other functions and events. You must assign a specific value to global variable when you declare it. If you type:
gvariable
you get a run-time “not defined” error because global variables can not have a value of null or undefined.
There is no way to bypass a “not defined” error, not even by using try-catch syntax since it is a run-time error. The JavaScript engine halts execution before “try” has a change to “catch” an exception. This is expected behavior of the JavaScript language. |
To prevent this error, assign a specific value to the global variable when declaring it:
gvariable=25
You should consider some naming convention to distinguish global variables from local variables, such as an extra “g” at the beginning of the global variable name.