Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Not applicable

ListBox - Always at least one Selected Value needed (not Always One Selected Value)

I want to have my Listbox (Qlikview 10.0 SR2) have the behavior or allowing many selections but always have at least one selected.  I am aware of the Property "Always One Selected value", but this is not the behavior I want.  I want "Always One or more selected values".  How can I acheive this?

1 Solution

Accepted Solutions
MVP
MVP

Re: ListBox - Always at least one Selected Value needed (not Always One Selected Value)

You could use triggers in Settings - Document properties for a Field Event (OnChange and OnSelect) to achieve this.

For example, if your field is Month, select Action Select - Select in Field with field

Month

and as search string

='('&if(GetSelectedCount( Month )=0,month(today()),GetFieldSelections( Month,'|' ) )&')'

This will have always one or more values selected (if you clear the selection, the month of today is selected).

View solution in original post

5 Replies
MVP
MVP

Re: ListBox - Always at least one Selected Value needed (not Always One Selected Value)

You could use triggers in Settings - Document properties for a Field Event (OnChange and OnSelect) to achieve this.

For example, if your field is Month, select Action Select - Select in Field with field

Month

and as search string

='('&if(GetSelectedCount( Month )=0,month(today()),GetFieldSelections( Month,'|' ) )&')'

This will have always one or more values selected (if you clear the selection, the month of today is selected).

View solution in original post

Not applicable

Re: ListBox - Always at least one Selected Value needed (not Always One Selected Value)

This is a great solution.  Thanks for the help!

harshalgawande
New Contributor II

Re: ListBox - Always at least one Selected Value needed (not Always One Selected Value)

Nice Solution.

jessica_webb
Contributor III

Re: ListBox - Always at least one Selected Value needed (not Always One Selected Value)

Hi swuehl,

This is just what I'm looking for, but I'm struggling to apply it to my measures.

The field is called 'Location', and I would like it to default to 'London'.

So I'm trying:

='('&if(GetSelectedCount( Location)=0,'London'),GetFieldSelections( Location,'|' ) )&')'


But that doesn't seem to be right.



Are you able to advise?
Many thanks.

MVP
MVP

Re: ListBox - Always at least one Selected Value needed (not Always One Selected Value)

Jessica,

I think you need to remove the closing bracket after 'London':

='('&if(GetSelectedCount( Location)=0,'London',GetFieldSelections( Location,'|' ) )&')'