on 02-20-2015 10:57 PM
Hi,
I have a design studio dashboard based on a universe. There is a listbox filter in the dashboard. The users can select single or multiple values from the listbox. We need to pass those values to a prompt in one of the data sources.
It works fine when users select single value from the Listbox, but doesn't work for multiple selections.
Here is the code for passing single value.
APPLICATION.setVariableValue("pmEnterCompanyCode", LISTBOX_COMPANY_CODE.getSelectedValue());
It doesn't accept LISTBOX_COMPANY_CODE.getSelectedValues() for multi value selection.
We are on Design Studio 1.2.
Any suggestion or work aorund for this requirement?
Thanks in advance for your response.
Regards
Saubhagya
Hi,
the only way is to use loops, which are delivered in release 1.3.
then you can declare a variable:
var values = LISTBOX_COMPANY_CODE.getSelectedValues();
and loop on it, creating list of single selections
var listToFilter = "";
.forEach(function(element, index) {
listToFilter = listToFilter + " " + element + ";";
}
and finally you can pass it to the variable:
APPLICATION.setVariableValueExt("pmEnterCompanyCode", listToFilter);
Important, the "setVariableValueExt" is accepting the external key, so the listbox must be filled in with external key.
Unfortunately, for this you should take the minimum of DS 1.3 (1.4 is preferred).
Karol
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Karol,
We have a multi value prompt - family. This is added in one of the universe based data sources.
My objective is to pass the multiple values selected from the LISTBOX.
I tried something similar to what you did, but that seems not working.
Assuming in SQL the syntax for multiple value prompts would be
column IN ('family1','family2','family3') which is passed by the prompt.
string_fam.forEach(function(element,index)
{
if(index==0)
{T_fam="('"+element;} else if(element !="All")
{T_fam=T_fam + "','" +element;}
}
);
T_fam=T_fam+"')";
APPLICATION.setVariableValueExt("pmfamily", T_fam);
I have rendered the output of this in a text box, which shows correct syntax as SQL.
('family1','family2','family3')
However the filtering does not work here. I am using DS 1.3. Anything else which could be tried?
Thanks
Abhi
HI Abhi,
you cannot use SQL syntax in Design Studio filter / variable. the syntax here is much simpler.
for multiple single values, use:
VAL_1; VAL_2; VAL_3
important is, separator is always ;
you need to make space after ;
the best try is always, use the standard filter panel, select values manually and make a button which uses the function DS.getFilterValueExt(). This will return you the correct syntax.
for your example, it should be
var T_fam = "";
string_fam.forEach(function(element,index) {
T_fam = T_fam + " " + element + ";";
});
APPLICATION.setVariableValueExt("pmfamily", T_fam);
Karol
Hi,
as far I know the multi-filters can be currently only passed using the "Ext" methods for filters and variables. The reason is, the "Ext" stands for "external representation" and this is parsed - so you can pass:
many values: A;B;C;
exclusion: !A;!B;
ranges: A - B;F - W;
I do not know any other method in scripting.
Karol
Hi Saubhagya Nayak,
In Design Studio, you cannot pass multiple values to a variable using setVariableValue - it will only accept single values. Try using the following script instead:
APPLICATION.setVariableValueExt("pmEnterCompanyCode", LISTBOX_COMPANY_CODE.getSelectedValue());
Thanks and Regards,
Eshwar Prasanna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try Following Code .
if (DS1_1.getFilterExt("COMPANY") =="")
{
Comps = "no_value" ;
}
else {
Comps = Convert.replaceAll(Convert.replaceAll(DS1_1.getFilterExt("COMPANY"), "\\", ""), "; ", ";");
}
// Use Comps in your Opendoc syntax for passing Company Codes .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.