Go Back   Forum - BIRT Exchange > Designing BIRT Reports Forums > Designing BIRT Reports

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-27-2010, 06:34 AM
Member
 
Join Date: Feb 2008
Posts: 47
Unhappy Parameter value override based on dataset return - 2.5.0 Fail

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
Reply With Quote
  #2 (permalink)  
Old 01-28-2010, 05:27 PM
Member
 
Join Date: Feb 2008
Posts: 47
Default 2.5.0 approaches that work

I scripted the replacement into the default value for the parameter using the fx dropdown in the edit parameter dialog
Reply With Quote
  #3 (permalink)  
Old 03-10-2010, 06:46 AM
Junior Member
 
Join Date: Mar 2009
Posts: 1
Default

Quote:
Originally Posted by rpolunsky View Post
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

modifying query like this

Select city from offices where officecode = <PARAM1>


in beforeOpen event of dataset


this can be done

this.queryText = this.queryText.replaceAll("<PARAM1>", 3 );

this will accomplish desired results.
Reply With Quote
Reply


Thread Tools
Display Modes




All times are GMT -7. The time now is 10:50 AM.
Powered by vBulletin Copyright © 2000-2010 Jelsoft Enterprises Limited.


Content Relevant URLs by vBSEO 3.1.0