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)
setting a parametervalue before parameter-window
shazia
Hi,
i want to achieve this:
//1- if i have earlier set parameters in session as attribute
reportContext.getHttpServletRequest().getSession().getAttribute("earlierSetParameters")
//2- then i want to retrieve the parameters and set the parametervalues on the parameters, so that the user doesnt get shown the parameter-page if he has earlier ran this report.
my question is:
how can i set the parameters in script. Maybe i can do this in the "beforeFactory". I am looking for the syntax, example:
reportContext.getDesignHandle().setParameterValue("parametername","parametervalue") ?
Find more posts tagged with
Comments
shazia
if i try this in the "beforeFactory"-script:
reportContext.setParameterValue("testing","hello");
the value for the parameter "testing" is not set.
kclark
You can use<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
params["paramName"].value = "some data";
</pre>
<br />
<br />
To set the params, you can test this by adding a label to your report and setting the value in onPrepare<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
reportContext.getDesignHandle().getElementByID(10).text = params["paramName"];
</pre>
shazia
hi kclark, i appreciate your reply, but i cant make it to work. This is what i tried:<br />
<br />
-In my report i have placed a "Text-box Parameter" with the name "testing". <br />
-In report "onPrepare"-script, i placed this line of code:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>params["testing"].value="somedata";</pre>
<br />
When i run the report and the report parameter page is shown, the parameter is still empty, it should have shown "somedata".<br />
<br />
I am using birt 4.2.0<br />
<br />
Thanks.<br />
<br />
<br />
<br />
<blockquote class='ipsBlockquote' data-author="'kclark'" data-cid="111830" data-time="1353942468" data-date="26 November 2012 - 08:07 AM"><p>
You can use<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
params["paramName"].value = "some data";
</pre>
<br />
<br />
To set the params, you can test this by adding a label to your report and setting the value in onPrepare<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
reportContext.getDesignHandle().getElementByID(10).text = params["paramName"];
</pre></p></blockquote>