Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

create varible in script based on multiple listbox selections

can I create a variable in script that concatenates and stores up to three selected fields in three separate list boxes?

For example:

vCondition = concat(getfieldselection(SubRegion),getfieldselection(Quarter),getfieldselection(GBU))

6 Replies
maxgro
MVP
MVP

getfieldselection doesn't work in the script

Anonymous
Not applicable
Author

Hi,

Like Massimo posted,this won't work in script. But you can assign an action to a button which sets a variable value . Defining this you could use = concat(x,'/') & '/' & concat(y,'/')

The variable defined this way can be called in script.

Best regards

Stefan

Not applicable
Author

I need the targets to change when the filter is clicked so I don't want to put an extra button because that would take away from the usability of the site. can I use the above statement on all three fields? A user may click on only one or on all of the three possible fields.

Anonymous
Not applicable
Author

Hi,

in this case you need a field trigger for each of these listboxes, thought you wanted this in your load script. in all 3 Triggers use  set Variable as action, which all set vCondition. The above formula will return also possible values and not only selected values. If you don't want unselected fieldvalues in this variable, modify it for example to:

=if(getselectedcount(FiscalYear) > 0, concat(distinct FiscalYear,'/') & if(getselectedcount(FiscalYear) >0, '/') ) & if( getselectedcount(FiscalYear) >0, concat(distinct FiscalYear,'/'))

But if this works depends on what you need the variable value for.

Best regards

Stefan

Anonymous
Not applicable
Author

Hi,

For attaching a field, yuo can use:

SubRegion&''&Quarter&''&GBU

Not applicable
Author

I do want this in the load script but you mentioned adding an action to a button and I don't want that. is there a way to add it to my load script without using a button? or did I misunderstand you?

As I have been working on this I tried another angle and I have created and loaded a table with all the target values I need.  There are two columns > Condition and TargetHow would I match the fields chosen by the user to the condition column?

For example:

User chooses SubRegion > EMCIE, Quarter > Q2, GBU > ABS from the associated listboxes.

My condition is EMCIEQ2ABS.

How do I tell the filters chosen to go look up and match the value in the Condition column?

I was able to get the selected fields using

=only(SubRegion)&only(Quarter)&only(GBU)

This returns the same value as above: EMCIEQ2ABS.

However if I try to use the statement

=if(Condition=only(SubRegion)&only(Quarter)&only(GBU),Target,0)

it always returns 0 instead of the Target value unless I manually select the matching field in the Condition listbox.

I need the filters selected to go select the corresponding value in the Condition box. This is where I'm stumped.