Home
Analytics
How to access report variable in masterpage
vivekpv10
In my report i have one report varibale(ie.global variable).I want to access it masterpage.How can access it in masterpage.Can anyone pls share syntax(eg: like <VALUE-OF>vars["abc"]</VALUE-OF>).
Find more posts tagged with
Comments
kclark
First create your variable, I created mine via the UI, right click variables > new variable > page variable. Then set the default value, make sure you have quote around the text. Then go to the master page tab, open the paletter and drag the variable autotext on the master page. You should be able to select your variable from the drop down.
vivekpv10
<blockquote class='ipsBlockquote' data-author="'kclark'" data-cid="112080" data-time="1354728541" data-date="05 December 2012 - 10:29 AM"><p>
First create your variable, I created mine via the UI, right click variables > new variable > page variable. Then set the default value, make sure you have quote around the text. Then go to the master page tab, open the paletter and drag the variable autotext on the master page. You should be able to select your variable from the drop down.<br /></p></blockquote>
<br />
In master page header,i have one text element with type as HTML,there i want to get this report variable.Also report variable value is not a constant.Its value is changing dynamically(ie value is reassigned in an event "Oncreate" of one of the dataset).I tried and it is possible to access it in text field.But its value is always constant,same Default value when variable is created.
vivekpv10
@kclark
...any updation on this issue??
Tubal
You could use either a global variable or a page variable, depending on what you are trying to do.<br />
<br />
The syntax to set your variable in your dataSet onCreate would be:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>reportContext.setPersistentGlobalVariable("myVariable",whatever);</pre>
<br />
Keep in mind that if you're only calling your dataset one time, this is only going to set the variable once, but I assume you know what you're doing.<br />
<br />
Then the syntax to call it would be:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>reportContext.getPersistentGlobalVariable("myVariable");</pre>
<br />
<br />
I haven't been able to get this to work with a text element. So I just use a label element, and change the value of the label element in script. In the onCreate of the label element in the master page, you would put something like:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>this.text = reportContext.getPersistentGlobalVariable("myVariable");</pre>
<br />
Also, this will only work if run and render are two separate tasks. So it won't work in your eclipse preview. You'll have to preview the report in a web browser.
vivekpv10
@Tubal
..Actually i need to embed this variable in an an html .So that i am using text element.
vivekpv10
i still stuck with this issue..is any solution to this issue
Suresh KR
<p>Vivek Did you find Solution?</p>