Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I have a list box with a set of values, and I want to force the user to choose only one at a time, not as many as he wants, how can I do this?
Thanks
Alexandra
If you're using QlikView 9, it can be done with an Action. I still haven't decided if Actions are inherently easier than Macros.
On your field, set up an OnSelect Action. Choose Select in a Field. Choose your Field. And for the Select, use:
=SubField(GetFieldSelections(Field), ',', 1)
You could modify the Subfield function to choose a value other than the first. Replace the 1 with GetSelectedCount(Field) and you should get the last item selected.
Hi nMiller,
I searched the Community and found your excellent solution to prevent users from selecting more than one single value from a listbox. It helped me a lot but I have (at least) one more issue to deal with: The field to be restricted exists on several other sheets but the restriction should just be valid for one singe sheet. I haved tried the following expression (the fieldname is "Make"):
=If(GetActiveSheetID()='Document\SH02',SubField(GetFieldSelections(Make), ',', 1),GetFieldSelections(Make))
But it only works on sheet SH02. On all other sheets, more than one selected value (which should be allowed) returns NULL.
I hope that you - or some other QV-Guru - can give me a good advise how to do!
Okay, let me make sure I have this straight. On one sheet, you only want the user to be able to select one value (or none), but any other sheet, they can select multiple. What happens if the user selects multiple and then goes back to look at the Select One sheet?
One option may be to load the field in twice. One name it field_name and the other field_name_select1. On your Select One sheet, add field_name_select1 with the one select trigger. Then on your other sheets, use the normal one. In this case, multiple selections made on another sheet will affect the Select One sheet.
If you don't want multiple selections on the other sheets to affect the Select One sheet, then you'd probably need two separate datasets.
Thanks for quick response. I think i'll load the field twice. I've done so in similar situations.
But - seen from a newbee's horizon - I thought that the "Else" option in my If-statement was a great idea! 😉
Once you said that the expression didn't work, I kind of ignored it. I believe the problem is that GetFieldSelections returns a comma-separated list, but QlikView will not Select all values in a comma-separated list (it doesn't work using .Select in a macro either). It was a good idea, I wish it did work like that. Instead, we have to use ToggleSelect to select additional values (ToggleSelect is like keep the current selection and select).
I wonder if there is a way to handle this in a Trigger without double loading the field. I think it would be pretty easy in a macro, because you could do the conditional before doing the select.
Do you have the exact solution for this?
hi soltuons works fine without ctrl+shift button at a time,
but if we select ctrl+shift button and all the values it select more then one value