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)
"Select All" functionality in parameters
shar
Hi,
I have a need to generate a dynamic, multiple values allowed, is required, text box parameter that will default to "Select All" - even though Select All doesn't exist within the dataset (which is a CSV). Is this possible? I was able to get it working for a single value parameter, but not for multi value set.
BIRT version is 2.6.0
Let me know if you need more info. thanks
Find more posts tagged with
Comments
mwilliams
If you have access to your CSV and can add it to the actual data file as an option, you could set your filter up to work with the value, "Select All". Does it not show up if you add "Select All" as the default value of your parameter?
shar
hey Michael thanks for the reply.
I don't have the ability to access the CSV (it gets generated from our system and that won't change, not for me anyway
)
Tubal
I assume you mean a multiple value list box, not a text box? <br />
<br />
Could you just make it not required, and script the select all into your query if it's null?<br />
<br />
I do that in several reports.<br />
<br />
By making it Not Required, it leaves a blank spot and a 'Null Value' in your list. So your script would have to catch those too.<br />
<br />
In my beforeOpen script, I do something along the lines of: <br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>var parmcount = params["ven_cd"].value.length;
var vendors = "";
for ( i=0; i < parmcount; i++ ){
if( params["ven_cd"].value[i] != null && params["ven_cd"].value[i] != '') {
if( i == 0){
vendors = vendors + "'" + params["ven_cd"].value[i] + "'";
} else {
vendors = vendors + "," + "'" + params["ven_cd"].value[i] + "'";
}
} else {parmcount = parmcount - 1}
}
if ( parmcount > 0){
this.queryText = this.queryText.replace("/**vendors**/", " s.vendor_cd IN (" + vendors + ") and ");
} else {vendors = 'All Vendors'}</pre>
<br />
I use 3.7.1. Not sure if this was available in 2.6.0.
shar
Hi Tubal,
I'm looking into your solution (thanks) but before I go further, is this for a CSV dataset?
shar
@ Michael,
Sorry I missed your last point about the default value - yes it's not showing up when using the default value. It works for almost all other parameter options except this one specifically.
Tubal
<blockquote class='ipsBlockquote' data-author="'shar'" data-cid="91063" data-time="1323383258" data-date="08 December 2011 - 03:27 PM"><p>
Hi Tubal,<br />
<br />
I'm looking into your solution (thanks) but before I go further, is this for a CSV dataset?<br /></p></blockquote>
<br />
The way I used it was for an SQL query, but I imagine you could script something to work in a CSV data source as well. I've only ever worked with databases as data sources.
shar
Hey I had a go but no luck by changing the query, any other suggestions?
At the moment I'm using another filter, a check box, which overrules the list when it's selected. It's lame.
johnw
Your only option here is an external parameter dialog page with the ALL option in it. In BIRT 2.3, it used to be possible to put in a Default of ALL even if it wasnt in the selection list, and you would just test for that, but it doesnt seem to work in the 2.5, 2.6, or 3.7 versions.
It "might" be possible to do this in two reports using the parameters getDefaultValue and getSelectionList events. You would use a data or parameter extraction task to pull the possible values from report 2 and just append the ALL string to the returned list. I haven't tried it.
The best option is going to be the external page.
shar
Thanks for the info John.