Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Selecting multiple fields in multi box issues

Hi All,

When i select multiple fields in multi box ,all the selected fields are appearing in the current selections box.The problem is I want to hide an object based on the selected multiple fields.How can i write expression for this??

If  single field is selected  i can write expression like

if(field<>'demo',true(),false()).

How can i write the expression if multiple fields are selected?

Thanks in Advance

4 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

To hide an object if more than one value is selected in Myfield: If(getselectedcount(MyField)>1,0,1)

If you need to check for specific values, test and test2 and test3:

if(SubStringCount(Concat(MyField, '|'), 'test') and SubStringCount(Concat(MyField, '|'), 'test2') and SubStringCount(Concat(MyField, '|'), 'test3'), 0,1)


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks Gysbert,

I didn't fully understand your solution as i am new to qlikview and writing expressions.Can you please elaborate it with a sample qvw so that it will be more helpful to me.

O11235
Contributor III
Contributor III

Hi, I stand corrected but Gysbert’s expression takes the
selection from MyField and concatenates  this result with ‘|’. ‘|’ being a character
which is unlikely  to occur in most strings unlike an alphabetical character such as a,b,c,…  The concatenation returns a string regardless of nature of the entries within MyField. Now SubStringCount which works with
strings is then able to look for ‘test’ (an option in MyField?) as in the case of
the  first if statement (check out the help file on ‘if’ statements if need be). Should SubStringCount find ‘test’ it
counts the number of occurances and returns a 1 since it only occurred once. Now we have a typical if
statement with a Boolean decision making structure – 1 or 0.

Thanks Gysbert and Yepuri

Not applicable
Author

If you want to hide/show an object based on the multiple selection of your field in the multibox,

then just simply use the getselectedcount() function in the layout conditon of your object.

In your case, just write getSelectedCount(Fieldname)=1 in the layout condition of the object.

Try this,it will work.Let us know in case of any difficulties.