Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Select at least one value in dropdown in multibox

Hi,

I am using a multibox which has 287 values.

Currenty user can select multiple values and if remove that filter/multibox all of the values are removed.

I know there is one option to allow user to select one value at a time this way filter will not be removed even if user hit reset selection.

Is there a way to force user to select "at least" (with selection of multiple values at the same time) one value in multibox?

Thanks in advance.

TA

1 Solution

Accepted Solutions
CELAMBARASAN
Partner - Champion
Partner - Champion

Use Trigger to do this

I attached a sample

Check the Field event triggers in the Trigger tab of the document properties.

View solution in original post

9 Replies
MayilVahanan

HI

Are you asking about one selection in the multibox ?

if so, properties->Presentation -> Tick Always one selected value.

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Thanks for your reply. I know this option, but I want to allow user at least one selection. With this option, user can not select multiple values.

My requirement is to allow user to select at least one but they should be able to select more than one as well.

Thanks,

TA

CELAMBARASAN
Partner - Champion
Partner - Champion

Use Trigger to do this

I attached a sample

Check the Field event triggers in the Trigger tab of the document properties.

MayilVahanan

HI

Used in trigger

select in year filed:

=If(GetSelectedCount(Year)=0,Max({$1}Year),'('&Concat(Year,'|')&')')

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Hi Celambarasan,

Thanks a lot for your input and I got what I was looking for except one liitle thing.

Suppose user has selected 5 countries and last country in the selection list is "India". When user clicks on reset selections, it removes all the countries except last country in the list "India". In other case if the last country in the list is "Germany" in a selection of 22 countires, when reset selections is clicked, all countries are removed and only "Germany" is left. My questions is, instead of leaving last country in the list, when user clicks on reset selections, all countries in the list should removed and a defualt country e.g "Afghanistan" (first country in the alphabetical list) should seleted every time?

I hope I am clear to make my point.

Thanks,

TA

Not applicable
Author

Hi Celambarasan,

I have attached updated version (added few more countries, including "Inida Pakistan" and "United States" ) of your sample qvw.

Here are my questions:

1. Why following countries are not selectable in list box:?

"Inida Pakistan" and "United States" (the only difference between these countires and other countires is that these countires have two parts of the names and there is a space between them)

When you try to single select them, they are not selectable and whey you try to select them along others they are not selectable either. Why they are not selectable?

2. How can I ensure that after every time I click on reset selection, "India" remains selected as by default selection?

Looking forward to hearing from you.

Thanks,

TA



Not applicable
Author

Hi Mayil,

Thanks for your reply it was helpful but I could find exectly what I was looking for.

Can you explain your expression?

Thanks,

CELAMBARASAN
Partner - Champion
Partner - Champion

Please check the attached file.

1. It is not working because of space in between the 2 words which is fixed in this.

2. You set the default value instead of Max(field). As per your example I have changed the expression.

Hope it helps

Celambarasan

yakir_manor
Contributor III
Contributor III

even though you already got your answer i think there's a room for one more answer,

for me i needed 3 more things:

- at least one selected value

- no impact from space in the value

- no effect what so ever by 'Clear All' event

i also wanted a dimension with only one selected value but without using the qlikview special feature because it destroys the server bookmarks, you can remove a field with 'Always one...'  but when adding one the old bookmarks are missing it so they stop work, this is super annoying so i solved that too (:

you need to look in the 'File -> Edit Script' for comments, and also in the 'Tools -> Edit Module...'

if your using qlikview server to show data you can see that pressing the clear button keeps everything yet something is not working right, that is because there's an issue with using the Action: Actions -> Add -> Selection -> Clear All, it clears all fields without running the OnSelect event (bug?), this can be solved by doing it using macro, you can see the attached file for know how.

if for some reason you need to also unlock all fields ( maybe you hide all tabs and did button based navigation and you lock some dimension on each page) then change the macro function to this:

Sub ClearAllMacro

  ActiveDocument.UnlockAll true

  ActiveDocument.ClearAll true

End Sub