Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
richard_chilvers
Specialist
Specialist

How to Clear 'Always One Selected Value' ?

In a selection object, it is useful to tick the option 'Always One Selected Value'. This means that only one value can be selected at a time.

However, I need to also be able to clear all selections on the field to see all values.

Is there any way to achieve this ?

Thanks

6 Replies
jcampbell474
Creator III
Creator III

Not aware of a straightforward way to do what you're describing with the Always One Selected Value property checked.  However, there are some ideas/workarounds in this thread: https://community.qlik.com/thread/36497

Anil_Babu_Samineni

Look for DV solution. Tested and and it's working

How to clear the Always One selected value

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
avinashelite

As per I know their is not direct method ..we need to use the macro for the same

jcampbell474
Creator III
Creator III

Ok, try this:

In Settings > Document Properties > Triggers > Field Event Triggers (Highlight the field) > OnSelect Add Action(s).

Click Add > Selection > Select in Field.  Enter the field name, then this expression in the Search String.

=SubField(GetFieldSelections(yourfield), ',', 1)

Press OK and you should be done.

Here is a thread for reference: list box - how to force to choose only one value

MarcoWedel

MarcoWedel

maybe using one of these expressions as search string in a search in field action at the OnSelect field event trigger of the your field (year in this example):

=If(GetSelectedCount(Year)>1,Only({$1} Year),Only(Year))

=Only($(=If(GetSelectedCount(Year)>1,'{$1}','')) Year)

see attached example

hope this helps

regards

Marco