Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Not applicable

How to disable multi-select in list box

Hi all, I am greener of qlikview, Currently facing a problem as subject, I can't find a solution to disable multi-select in list box. We all kown that we can tick the option 'Always one selected value' in the list box property, tab 'General'. But it also bring side effort that make us can't implement unselect operation.

Does any one know how to only disable multi-select in a simple way? Really thx!

1 Solution

Accepted Solutions
kuba_michalik
Contributor III

Re: How to disable multi-select in list box

You don't really need a macro.

Set up a trigger for a field on an OnSelect event (Settings -> Document Properties -> Triggers). For field FIELD set up Selection -> Select in Field -> use =Only(FIELD) as Search String. Now if somebody selects one value, it gets selected, if somebody selects more than one - all get deselected immediately after.

EDIT: I'm including a quick example

7 Replies
MVP
MVP

How to disable multi-select in list box

Hi,

Select a single option and check properties, Now this option is enable.

Regards,

jagan.

ekech_infomotio
Contributor II

Re: How to disable multi-select in list box

Hi Paul,

is it right that you sometimes want "Always one selected value" and sometimes not?

AFAIK it is only possible via macro -  you will need two subroutines:

sub set_singlevalue

'please notice that you have to select a value before the option can be set

          activedocument.fields("yourfieldname").select "yourdefaultvalue"

          set fYOURFIELDNAME = activedocument.getfield("yourfieldname")

          set prop = fYOURFIELDNAME.getproperties

          prop.OneAndOnlyOne = true

          fYOURFIELDNAME.SetProperties prop

end sub

sub set_multivalue

  set fYOURFIELDNAME = activedocument.getfield("yourfieldname")

  set prop = fYOURFIELDNAME.getproperties

  prop.OneAndOnlyOne = false

  fYOURFIELDNAME.SetProperties prop

end sub

then create two buttons (or text-objects) and set "EXTERNAL" ==> "Run Macro" as Action - one with set_multivalue and one with set_singlevalue.

please notice that you have to select a value before

regards,

Edgar

Not applicable

Re: How to disable multi-select in list box

thx for reply, but problem is that option is only for 'always select one value', which can't fullfill the requirement the situation of select none of them. Now my biz requirement is as below:

1.can select one value

2.can select none of the value

3.can't select multi-value

Do you know how to implement it?

Not applicable

Re: How to disable multi-select in list box

THX edgar, seem this micro still can't fix the problem o. maybe I didnt descript well.

This problem is: I can't select multi velue like below snapshot

========

A(selected)

B(selected)

C(un-select)

========


But i need impletement below 2 kinds of situations.

=========

A(selected)

B(un-select)

C(un-select)

=========

and

=========

A(un-select)

B(un-select)

C(un-select)

=========

kuba_michalik
Contributor III

Re: How to disable multi-select in list box

You don't really need a macro.

Set up a trigger for a field on an OnSelect event (Settings -> Document Properties -> Triggers). For field FIELD set up Selection -> Select in Field -> use =Only(FIELD) as Search String. Now if somebody selects one value, it gets selected, if somebody selects more than one - all get deselected immediately after.

EDIT: I'm including a quick example

Not applicable

Re: How to disable multi-select in list box

Really thx Kuba. It works perfectSmiley Happy

ekech_infomotio
Contributor II

Re: How to disable multi-select in list box

cool. didn't know until now ;-)

Community Browser