Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Multi Select Paramater
LetsBIRT
Hi,
Is there a way to display the paramters selected in the multi value select paramter, on the report.
i want to see how is the list of parameters being sent to the query.
I am using BIRT 2.2
Thank you.
Find more posts tagged with
Comments
cypherdj
Hi,<br />
<br />
Birt 2.2 does not support multi-value query parameter. So you can define a multi-select report parameter, but won't be able to tie it directly to a query.<br />
<br />
In order to achieve what you want to do, you would need to add a beforeOpen script to modify the queryText variable of your data set.<br />
<br />
Here is an example with integer/string values passed into an IN clause, you may want to add some logging to your script as well if it isn't working for you.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
prmWorkTypes = params["rpt_workTypes"].value;
if (prmWorkTypes!=null && prmWorkTypes!="") {
this.queryText = this.queryText
+ " WHERE workType IN (" + concatMultiSelectValues(prmWorkTypes) + ")";
}
function concatMultiSelectValues(valuesArray) {
var concatValues = "";
for (idx=0; idx < valuesArray.length; idx++) {
concatValues = concatValues.concat(valuesArray[idx] + ", ");
// string version
// concatValues = concatValues.concat("'" + valuesArray[idx] + "', ");
}
// remove last ", "
concatValues = concatValues.substr(0, concatValues.length - 2);
return concatValues;
}
</pre>
<br />
Hoping that helps,<br />
Cedric
LetsBIRT
Thanks Cedric for the response, but i think i did not frame my question correctly.
What i meant was, I am able to pass the parameters to the query directly as there is a "IN" clause in the query filters.
The issue that i have is: When the user selects a bunch of paramters and runs the report, i need to display these selected parameters on my report. How can i do this?
Please help.
Thanks.
cypherdj
Ok, you could, say, include a table on your report (don't tie it to a dataset), and drop data elements in the relevant cells. Simply use the following expression builder for each multiselect parameter<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
concatValues = "";
data = params["yourParam"].value;
for (idx=0; idx < data.length; idx++) {
concatValues = concatValues.concat(data[idx] + ", ");
}
// remove last ", "
concatValues = concatValues.substr(0, concatValues.length - 2);
concatValues;
</pre>
<br />
This should allow you to display the selected value(s) as a comma-separated string.<br />
<br />
For any other (non-multiselect) parameter, simply use params["paramName"] as your expression.<br />
<br />
I tried this with a multi-value parameter and obviously it shows the underlying values rather than display texts.<br />
<br />
hope that helps,<br />
Cedric
rpolunsky
Also you can clone the dataset you used to populate your multiselect parameter, filter it with the same IN logic based on the user selection, then drag that table to the report and get a list of the user picks that way.
LetsBIRT
Thank you very much the help! It workd.
al91206
I needed to create a multiple parameter prompt and then display the results.
Searching the forums I found this great example in this post. It worked, so I figured I would add an example report just to make this a complete how-to example.
This example shows how to create a multiple parameters prompt and then how to display the chosen values on your report. It uses the classicmodels sample data source.
FYI
Al in SoCal
mwilliams
Al,
You could place your example in the devShare also if you would like.