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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
jasonseril
Creator
Creator

limited selections

Hello all,

Say, I have a list box with 10 items. How should I limit the selections up to 5 only?

Thanks in advance and more power!

Jason ^^

1 Solution

Accepted Solutions
Not applicable

Hi Jason,

I think you can do this by adding a trigger that fires everytime the user makes a selection for the field. The trigger tests the count of values in the field and if it's >5, then the trigger clears the selection for the field.

For an example I used a field named YEAR. So in Document Properties -- Triggers tab, add a Field Event Trigger for the OnSelect event for the field YEAR.

Use the Action "Select In Field". For "Field" I entered =if(count(YEAR))>5,'YEAR','') for "Search String" I entered just an equals sign.

So if the count(YEAR) is > 5 then the trigger clears the selection on the field YEAR. If <= 5 the trigger does nothing.

regards,

Paul

View solution in original post

5 Replies
Not applicable

Jason

Interesting thought but I don't think it can be done, as a matter of interest, why would you want to do it as there might be another way to provide a solution.

Regards,

Anonymous
Not applicable

It can be done by a macro. It should count the slected values, and if it's >5, produce a message, and maybe apply some default selection.

Not applicable

Hi Jason,

I think you can do this by adding a trigger that fires everytime the user makes a selection for the field. The trigger tests the count of values in the field and if it's >5, then the trigger clears the selection for the field.

For an example I used a field named YEAR. So in Document Properties -- Triggers tab, add a Field Event Trigger for the OnSelect event for the field YEAR.

Use the Action "Select In Field". For "Field" I entered =if(count(YEAR))>5,'YEAR','') for "Search String" I entered just an equals sign.

So if the count(YEAR) is > 5 then the trigger clears the selection on the field YEAR. If <= 5 the trigger does nothing.

regards,

Paul

johnw
Champion III
Champion III

Here's an example I had lying around using the macro approach. It forces at least one selection, and doesn't allow more than 5 selections. Easy enough to remove the "at least one selection" part of it.

jasonseril
Creator
Creator
Author

Thank you all for the quick and wonderful answers. I really appreciate it. Thanks John for the example, this is what I'm looking for.

jason