Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
IMPORTANT security patches for GeoAnalytics Server available to download: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
singbittoo
Creator
Creator

limit selection in multibox

i want a user should be able to select max of three values from the multibox

1 Solution

Accepted Solutions
johnw
Champion III
Champion III

Expanding on this, and this is kind of funky, but rather than clearing the field if you select more than three, you can just prevent the change. Change your clear field to be <=3 instead of >3, then add a Back action after.

  1. clear field =if(getselectedcount(Name)<=3,'Name')
  2. back

As long as you've selected 3 or fewer, it clears the field, then does a back, taking you back to your intended selections. If you've selected more than 3, it doesn't clear the field, so when you go back, it removes your most recent selection that took you over the limit.

There's probably a cleaner way to do it, but that's what I thought of.

View solution in original post

12 Replies
Anil_Babu_Samineni

Why not list box

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
singbittoo
Creator
Creator
Author

it is the requirement ,, but if u can tell how to limit selection to max 3 in list box that will also be helpful

vcanale
Partner
Partner

Hi,
Try to Sort the field on Text or Numerical Value depending on the data
..or Expression also with =Max(fieldname)

singbittoo
Creator
Creator
Author

sorry not getting what u are saying

Anil_Babu_Samineni

Try Listbox as a Expression and then use this

=If(GetSelectedCount(FieldName)<=3,FieldName)

And then Try to select more than 3 and see, If no values are not Hidden you can create show one message for Text object to user like More than 3 Selections are not effected like that

Hope this Helps

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Not applicable

Hi abhishek ,

You could set up a trigger based on the selected count.

Hope the attached file is helpful.

Regards,

Karthik

singbittoo
Creator
Creator
Author

hi karthik i m sorry i m not getting any attached file can you please explain here

Not applicable

Assume you have a field called 'Name' consisting of five records . Now you would like to limit user's selection to 3 records. Go to Document properties->Triggers->Field event triggers and then choose the field ' Name ' .In the 'On select option ' write the following trigger .(Action=Clear field )

if(GetSelectedCount(Name)>3,'Name')

Regards,

Karthik.

rupamjyotidas
Specialist
Specialist

Sometimes requirements are crazy. Why do you want to ruin a simple list box/multi box with equation or triggers, just put a note (in a text box) above saying 'Max of Three values to be selected'. If the Users select more than three values , don't calculate anything, you can use conditional for the same.

But if you want to complicate the apps, you can always use triggers or Equation in the list box.