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)
params["****"].displayText not working as expected
evgenyak
Hello,<br />
<br />
Some of my parameters have default values:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
<scalar-parameter name="Filter_SiteId" id="111">
<text-property name="promptText">Site ID</text-property>
<property name="valueType">dynamic</property>
<property name="isRequired">true</property>
<property name="dataSetName">Sites Data Set</property>
<expression name="valueExpr" type="javascript">dataSetRow["site_id"]</expression>
<expression name="labelExpr" type="javascript">dataSetRow["site_host_name"]</expression>
<expression name="sortByColumn">dataSetRow["site_id"]</expression>
<property name="sortDirection">asc</property>
<property name="dataType">integer</property>
<property name="distinct">true</property>
<simple-property-list name="defaultValue">
<value type="constant">-1</value>
</simple-property-list>
<property name="paramType">simple</property>
<property name="controlType">list-box</property>
<property name="mustMatch">true</property>
<property name="fixedOrder">false</property>
<structure name="format">
<property name="category">Unformatted</property>
</structure>
</scalar-parameter>
</pre>
<br />
And I noticed that for some reason params["Filter_SiteId"].displayText is returning empty/null value.
Find more posts tagged with
Comments
kclark
Can you post the rptdesign please?
evgenyak
Attached
Thanks!
kclark
I used a dynamic text object to display the value of the parameter and it shows the default value fine with<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>params["Filter_SiteId"].value</pre>
<br />
I don't see in your report where you are trying to display the value of that parameter, but you might try value instead of displayText
evgenyak
I'm sorry, I intended to have displayText:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'><b>Site ID:</b> <value-of>if (params["Filter_SiteId"].value == '-1') { 'All' } else { params["Filter_SiteId"].displayText } </value-of></pre>
<br />
The problem is instead of displayText I get null (or empty string)<br />
value works. But I must have displayText
kclark
Instead of params["someparam"].displayText you could use reportContext.getParameterDisplayText("someParam") in an expression.
evgenyak
Can I just use <pre class='_prettyXprint _lang-auto _linenums:0'>reportContext.getParameterDisplayText("someParam")</pre> inside <value-of>?
evgenyak
<blockquote class='ipsBlockquote' data-author="'kclark'" data-cid="113587" data-time="1359128071" data-date="25 January 2013 - 08:34 AM"><p>
Instead of params["someparam"].displayText you could use reportContext.getParameterDisplayText("someParam") in an expression.<br /></p></blockquote>
<br />
I put <pre class='_prettyXprint _lang-auto _linenums:0'><value-of>reportContext.getParameterDisplayText("someParam")</value-of></pre> but it's still empty :unsure:
kclark
I've attached an example for you to take a look at. The parameter is displayed in dynamic text with<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'><value-of>reportContext.getParameterDisplayText("Filter_SiteId")</value-of></pre>
<br />
Then the site ID is later displayed in another dynamic text using this<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'><b>Site ID:</b> <value-of>if (params["Filter_SiteId"].value == '-1') { 'All' } else { params["Filter_SiteId"].displayText } </value-of></pre>
<br />
Let me know if this helps.