Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

naushad786
New 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
Support
Support

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

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 - Designated 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
New Contributor

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

Hi Bill,

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

Regards:

Naushad

nizamsha
Valued Contributor II

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

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

naushad786
New Contributor

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

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.

Partner
Partner

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

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

Bert

Support
Support

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

Hi Bert,

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

Bill

Bill - Designated 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.
MVP
MVP

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

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
New Contributor

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

Thanks Dijks.

Not applicable

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

+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!