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)
How to control the parameter assingment sequence onPrepare on two tables layout
Richard W
Here is the report structure:
1 Dataset with beforeOpen script to complete the WHERE clause
1 Hidden report parameter used to pass value to the Dataset script
2 Tables in the report with beforePrepare script to assign the report parameter
As I want to use the Table script to pass a parameter to the Dataset script to complete the WHERE clause, I assume the first table on the page would pass the parameter value to the Dataset and execute first, then the second table would pass another value to the Dataset and build the SQL with another WHERE clause. Looks the Dataset only take the parameter value set by the last table on the report and ignore the value set from the first table.
Am I not understanding how to use Table eventhandler works, or it could be a bug somewhere?
Richard
Find more posts tagged with
Comments
mwilliams
Richard,
I'm not sure if I'm understanding correctly or not. To do what I think it sounds like you're wanting to do, you'll need to create a dataSet that has the values you want to pass to the where clause of your original dataSet. Put a list in your report that is attached to this new dataSet with the where clause values, then embed a table in this table and attach it to the original dataSet. Select the binding tab in the property editor for the inner table and click the dataSet parameter binding button and set up the parameter value to be passed from the outer table. Let me know if I'm not understanding correctly or if you need a better explanation.
Richard W
Michael,
Thanks for the quick reply. As I'm very new to BIRT and I'm not able to explain the condition very well. I'm not trying to use one table to pass values to another table in the report. I have one dataset defined and two tables layout in the report, I want to use table script to pass the value to a report paramenter to the dataset so that I don't have to create two datasets.
Here is the script for the dataset:
if (params["company"] == "AHM") {
this.queryText = this.queryText + " where char(company_c) is not null group by vm order by server_count desc";
}
if (params["company"] == "CH") {
this.queryText = this.queryText + " where char(company_c) = 'CH' group by vm order by server_count desc";
}
I use Onprepare event to pass value to the company_c report parameter to build the WHERE clause. For table1 I'm passing company_c = 'AHM' but the dataset is getting the value 'CH'. Looks like I've no control of what value is being passed to the dataset when I've two tables on the report.
Richard
mwilliams
Richard,
Have you tried using a dataSet parameter and then setting the appropriate value using the dataSet parameter binding button on the binding tab of the table?