Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
Not applicable

Automatically select default value in listbox when selecting value in other listbox.

My question is kind of a complicated one to explain.

I have two listboxes; ShopId and PosId. a ShopId is unique, but a PosId isn't. Example population:

ShopId  |  PosId

1           |    1

1           |    2

2           |    1

3           |    1

There always has to be one and only one value selected in both listboxes ( PosId and ShopId).

My problem now is that when i select ShopId=1 and PosId=2, i can't click on ShopId=3 because ShopId3 doesn't have a PosId2.

I basically want to change my PosId to the lowest possible value when i select another shop (So that there will always be a selected value in both lisboxes).

If something is still unclear, please ask.

1 Solution

Accepted Solutions
MVP & Luminary
MVP & Luminary

Re: Automatically select default value in listbox when selecting value in  other listbox.

If you don't want a user to be able to make a selection then don't load data with any other values than those you want selected. In other words, hard-code your selection in the script with a where clause.


talk is cheap, supply exceeds demand
9 Replies
MVP & Luminary
MVP & Luminary

Re: Automatically select default value in listbox when selecting value in other listbox.

I don't understand why you can't click on ShopId 3. That should be possible. It should simply clear the PosId field, but there's no reason that I know of that wouldn't allow you to select ShopId 3. Can you post a small qlikview document that demonstrates this problem?


talk is cheap, supply exceeds demand
vikasmahajan
Esteemed Contributor

Re: Automatically select default value in listbox when selecting value in other listbox.

Check with this I think you can go with alternate states https://community.qlik.com/message/787428#787428

Vikas

Not applicable

Re: Automatically select default value in listbox when selecting value in other listbox.

I can indeed click on the other ShopId3 when i have the option ' always have one selected value' off. But i need that option to be 'on' in both listboxes.

To be clear: i ALWAYS want a value selected in both listboxes. I think the most simple way to do that is by setting PosID to 1 whenever another ShopId is selected, but i have no idea how i can do that.

Not applicable

Re: Automatically select default value in listbox when selecting value in other listbox.

I am not sure how i would use that. Can you give me more information?

MVP & Luminary
MVP & Luminary

Re: Automatically select default value in listbox when selecting value in  other listbox.

Add a Select in Field action to the field trigger to make a selection in the other field.


talk is cheap, supply exceeds demand
Not applicable

Re: Automatically select default value in listbox when selecting value in other listbox.

I tried doing exactly that, but can you tell me how exactly? I tried a trigger on ShopId select in field (field PosId) with search string 'min(PosId)'

I got it working as said above. but the problem is that i can still uncheck PosId and ShopId because i do not have the option 'always have one selected value' on. I don't want that to happen.

MVP & Luminary
MVP & Luminary

Re: Automatically select default value in listbox when selecting value in other listbox.

but the problem is that i can still uncheck PosId and ShopId

I'm afraid you've lost me. You will always be able to undo a selection. I don't understand the requirement to not be able to do that and I don't know of any way to achieve that.


talk is cheap, supply exceeds demand
Not applicable

Re: Automatically select default value in listbox when selecting value in other listbox.

you said "You will always be able to undo a selection.". That is exactly what i don't want. I need to have 1 Shop and 1 Pos selected at ANY time.

MVP & Luminary
MVP & Luminary

Re: Automatically select default value in listbox when selecting value in  other listbox.

If you don't want a user to be able to make a selection then don't load data with any other values than those you want selected. In other words, hard-code your selection in the script with a where clause.


talk is cheap, supply exceeds demand