cancel
Showing results for 
Search instead for 
Did you mean: 

Pass multiple values to a prompt in Design Stduio

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Karol-K
Advisor
Advisor
0 Kudos

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



Former Member
0 Kudos

Thanks Karol

I will try this when we upgrage to higher versions.

Regards
Saubhagya

Former Member
0 Kudos

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

Karol-K
Advisor
Advisor
0 Kudos

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

Former Member
0 Kudos

Hi Karol,

Thanks for your reply!

Indeed for Netweaver BW, this is working as per VAL_1; VAL_2; VAL_3 perfectly.

When I try to use it for BI platform based using "universes" which are based on HANA SQL database, this is not working.

Need to analyze more..

Best,

Abhi

former_member195675
Participant
0 Kudos

Hi Karol,

Would you say this is still the best way to do this, as per 1.6? We have exactly the same requirement, and are currently exploring our options.

Karol-K
Advisor
Advisor
0 Kudos

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

Answers (2)

Answers (2)

Former Member
0 Kudos

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

Former Member
0 Kudos

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 .