Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
naushad786
Contributor
Contributor

Condition wise “Always One Selected Value” Enable/Disable on Button Click

Hi Everyone,


I want to Condition wise “Always One Selected Value” Enable/Disable on Button Click. Suppose when I click on one button then it should be enabling but when I click on another button it should be disabling.

I already used macros but my requirement is not fulfilling, may be my macro code is wrong.


sub SetOneAndOnlyOne

set obj = ActiveDocument.GetSheetObject("LB143")

set boxfield=obj.GetField

set fprop = boxfield.GetProperties

if boxfield.GetFieldFlags.OneAndOnlyOne then

  1. fprop.OneAndOnlyOne = false

else

  1. fprop.OneAndOnlyOne = true

end if

  1. boxfield.SetProperties fprop

  end sub


Please help.

9 Replies
Bill_Britt
Former Employee
Former Employee

Looking at you image and what you are wanting to do Always One Selected Value isn't going to do it. Always One Selected Value doesn't stop you from selecting more than one value. It just means that some  value in the List Box has to be selected.

Bill

Bill - Principal Technical Support Engineer at Qlik
To help users find verified answers, please don't forget to use the "Accept as Solution" button on any posts that helped you resolve your problem or question.
naushad786
Contributor
Contributor
Author

Hi Bill,

So please suggest what should I do to fulfil my requirement.

Regards:

Naushad

nizamsha
Specialist II
Specialist II

right click any one value from left listbox and check always one selected value or else u cant enable always one selected value

naushad786
Contributor
Contributor
Author

I know this option but i want to handle this option conditionally on buttons click. When clicking on one button then it should be enabled and when clicking on another button it should be disabled.

bertdijks
Partner - Contributor III
Partner - Contributor III

Make two listboxes, one with  "always one selected value''  selected, and one not. Use the buttons to hide/show one of the tables.

Bert

Bill_Britt
Former Employee
Former Employee

Hi Bert,

Very good idea.... Marcos don't always work..

Bill

Bill - Principal Technical Support Engineer at Qlik
To help users find verified answers, please don't forget to use the "Accept as Solution" button on any posts that helped you resolve your problem or question.
jonathandienst
Partner - Champion III
Partner - Champion III

Bert

Will that work? My understanding is that the always one selected value is applied to the field (even though you enter it on the listbox object). If you change the setting on one list box, the setting will also change on the other listbox.

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
naushad786
Contributor
Contributor
Author

Thanks Dijks.

Not applicable

+1 on Jonathan's Post.. 'Always One Selected' is applied on the field.

Nushaud, perhaps you can look into using a Slider object to be able to achieve your requirement easier?

You can use 2 sliders, one with 'Multi Value' and another with  'Single Value' (same concept with the 2 listboxes Bert suggested). This should also allow you to have always at least one selected value (unless manually removed from another object).

Only issue would mainly be the appearance.. though you can always hide the scroll arrows..

HTH!