Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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)
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.
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
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.