BIRT v4.6 - Create a Dynamic Dataset Query Based on Parameter Inputs ? [message #1747371] |
Sun, 13 November 2016 23:03  |
Eclipse User |
|
|
|
My dataset query is like:
Select time.year, time.quarter, time.month, dim1.country, dim2.bank, fact.measure1
from fact
left join time on (fact.fkey=time.pkey)
left join dim1 on (fact.fkey1=dim1.pkey1)
left join dim2 on (fact.fkey2=dim2.pkey2)
I have created two computed columns:
comp_col1
if (params["param_time"] == "Year") {row["year"];}
else if (params["param_time"] == "Quarter") {row["quarter"];}
else if (params["param_time"] == "Month") {row["month"];}
else{0}
comp_col2
if (params["param_dim"] == "Country") {row["country"];}
else if (params["param_dim"] == "Bank") {row["bank"];}
else{0}
The two report parameters, param_time and param_dim, have the following static values:
param_time = Year, Quarter, Month
param_dim = Country and Bank (Country and Bank has many values)
In the crosstab, I have dragged [u]comp_col1 into the row area and comp_col2 into the column area and added measure1 in detail area.
When I run the report, I get to choose the Time and Dimension parameters and I get the desired result.
My requirement: Now, I need the dataset query to be built dynamically based on the user input values for the two paramaters i.e. I need a code in the beforeOpen window of my dataset, with following functional logic:
SELECT comp_col1, comp_col2, sum(fact.measure1)
FROM fact
WHERE comp_col1 = userinputvalue for param_time
AND comp_col2 = userinputvalue for param_dim
GROUP BY comp_col1, comp_col2
Looking forward to some advice and suggestions. My sample report atttached.
Best Regards
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03988 seconds