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

Always one selected value without using in properties "always one selected value"

Hi,

I need always have a selected value from a listbox without using the properties "Always one selected value".

This is possible?

Thanks,

César

6 Replies
matt_crowther
Luminary Alumni
Luminary Alumni

Cesar,

There is an macro command for AlwaysOneSelected listed in the Qlikview API guide the example usage is:

set flddescs = ActiveDocument.GetFieldDescriptions

for i = 0 to flddescs.Count - 1

    fdesc = flddescs(i)

    if fdesc.AlwaysOneSelected then

        msgbox(fdesc.Name & " is in always-one-selected-mode")

    else

        msgbox(fdesc.Name & " is not in always-one-selected-mode")

    end if

next

It doesn't apply directly to your situation but you may be able to adjust it accordingly.

All the best,

Matt

@QlikviewBI

Not applicable
Author

Thaks Matthew but the macro command not run in the web.

swuehl
MVP
MVP

You could potentially make use of triggers to limit your selection in list boxes to one selected value. I remember some posts in the past that handled it that way.

But why can't you just use the 'always one selected value' option?

Not applicable
Author

I had the same issue where I wanted the "Always one Selected value" behaviour, but did not want to have that option ticked in the list box settings. I also did not want to use macros.

To solve it, I created a "On Change" Document level trigger for the FIELD in question - ie each time the field changes, a trigger is activated. You can define what this "trigger" is to suit your needs, but I set it to select a predefined value/values in the list box. The result of all of this is that one value will always be selected.

Not applicable
Author

Dear Matthew,

Can You Please Briefly Explain How to Use the macros? or send me one test file please.

Thanks & Regards,

Nirmal.

Not applicable
Author

Could I ask why you don't want to use the property, seems like making life difficult without needing to.