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)
Parameter value override based on dataset return - 2.5.0 Fail
rpolunsky
I have a report design that worked in 2.3.0 but no longer works in 2.5.0. I have a parameter based on a dataset, and a script in beforeOpen that modifies the dataset results. In 2.3.0 the dependent parameter correctly shows the new result, but in 2.5.0 the dependent parameter shows the dataset results before the change.
The following describes the sample report I created to demonstrate this, using the Classic Models database.
1) Create parameter officeCode as String, TextBox, Required with default value '1'
2) Create data set select_simple as
select city from offices where officecode = ?
Assign parameter param_1 as String direction Input linked to report parameter officeCode
3) Edit the beforeOpen event script for the select_simple dataset as follows:
reportContext.setParameterValue("officeCode","3");
4) Create parameter select_result as String, ComboBox, Dynamic, Required
Using data set select_simple, value column CITY, no default value
Run the report. When the parameter dialog is displayed,
officeCode = '1'
select_result dropdown = 'NYC'
Now take that same report file and run it under 2.5.0
Run the report. When the parameter dialog is displayed,
officeCode = '1'
select_result dropdown = 'San Francisco'
Apparently in 2.5.0 the datasets are being run and dependent objects assigned before the 'beforeOpen' script executes.
As a clarifying note, the actual report in which this situation was observed was using a data set for report display as the dependent object, not a parameter.
Are there workarounds for this? It has been suggested that perhaps I can use the new getSelectionValueList and getDefaultValueList parameter script events to accomplish this. It has also been pointed out to me that relying on dataset evaluation order was never a safe thing to do in 2.3, but that's water under the bridge.
Richard A. Polunsky
Triple Point Technology
Houston, Texas USA
Find more posts tagged with
Comments
rpolunsky
I scripted the replacement into the default value for the parameter using the fx dropdown in the edit parameter dialog
Maninder
<blockquote class='ipsBlockquote' data-author="rpolunsky"><p>I have a report design that worked in 2.3.0 but no longer works in 2.5.0. I have a parameter based on a dataset, and a script in beforeOpen that modifies the dataset results. In 2.3.0 the dependent parameter correctly shows the new result, but in 2.5.0 the dependent parameter shows the dataset results before the change.<br />
<br />
The following describes the sample report I created to demonstrate this, using the Classic Models database.<br />
<br />
1) Create parameter officeCode as String, TextBox, Required with default value '1'<br />
<br />
2) Create data set select_simple as<br />
select city from offices where officecode = ?<br />
Assign parameter param_1 as String direction Input linked to report parameter officeCode<br />
<br />
3) Edit the beforeOpen event script for the select_simple dataset as follows:<br />
reportContext.setParameterValue("officeCode","3");<br />
<br />
4) Create parameter select_result as String, ComboBox, Dynamic, Required<br />
Using data set select_simple, value column CITY, no default value<br />
<br />
Run the report. When the parameter dialog is displayed,<br />
officeCode = '1'<br />
select_result dropdown = 'NYC'<br />
<br />
Now take that same report file and run it under 2.5.0<br />
<br />
Run the report. When the parameter dialog is displayed,<br />
officeCode = '1'<br />
select_result dropdown = 'San Francisco'<br />
<br />
Apparently in 2.5.0 the datasets are being run and dependent objects assigned before the 'beforeOpen' script executes.<br />
<br />
As a clarifying note, the actual report in which this situation was observed was using a data set for report display as the dependent object, not a parameter.<br />
<br />
Are there workarounds for this? It has been suggested that perhaps I can use the new getSelectionValueList and getDefaultValueList parameter script events to accomplish this. It has also been pointed out to me that relying on dataset evaluation order was never a safe thing to do in 2.3, but that's water under the bridge.<br />
<br />
Richard A. Polunsky<br />
Triple Point Technology<br />
Houston, Texas USA</p></blockquote>
<br />
<br />
modifying query like this<br />
<br />
Select city from offices where officecode = <PARAM1><br />
<br />
<br />
in beforeOpen event of dataset<br />
<br />
<br />
this can be done<br />
<br />
this.queryText = this.queryText.replaceAll("<PARAM1>", 3 ); <br />
<br />
this will accomplish desired results.