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

Help in Always one selected value in list box.

Dear all,

I have created a list box with field being given in variable and used in list box through expression .

As, i use the field through expression the feature always select one value Option get disabled.

So, is there is any way how to always select any one value while the data in list box is in Expression.

Please suggest any answer.

Kind Regards,

Pranav

10 Replies
erichshiino
Partner - Master
Partner - Master

Hi,

From the help:

Always one selected:

Checking this option assures that one value will always be selected, which is useful in documents where the data only makes sense when one value is already selected, such as one currency rate etc. This option is enabled after one value is already selected in the list box. This option is not available for calculated fields.

So, it will not be possible, you should create a regular field on script.

Hope it helps,

Erich

Not applicable
Author

Hi, Erich

can we do anything through writing macro.

can you please help me to write a macro to select one value when the sheet is launched.

Please suggest,

Regards,

Pranav

erichshiino
Partner - Master
Partner - Master

What is the content of your variable?

Not applicable
Author

The Contents are :

1.CountryName

2.PortPair

3.CustomerName

4.CarrierName

This all feilds are put in a variable Table1

and that variable i am using in List box through expression as $(Table1).

Try whether we can do it throuogh Macro.

Regards,

Pranav

erichshiino
Partner - Master
Partner - Master

What behavior do you expect? Because I think I should make one selection to each one of these fields and make them always one selected value, but would this make sense?

Should this happen onOpen or when the variable change?

Which value should be selected?

Not applicable
Author

hi,

yes i want it to happen on open of the sheet the first variable first value to be selected. rest didnt bother user can select

Regards,

Pranav

erichshiino
Partner - Master
Partner - Master

Hi, You can use a code like this:

SUB SELECT_ONE

    set v = ActiveDocument.Variables("Table1")

    field = v.GetContent.String

    selection = activedocument.Evaluate("MINSTRING({1}" & field & " )")

    ActiveDocument.Fields(field).Select selection

END SUB

You associate this with the onOpen trigger.

you can try it on the attachment

Regards,

Erich

Not applicable
Author

Hi Erich,

Thanks for the suggestion,

Ok can you tell me how to clear it as the field changes the old selected field should get clear.

Regards,

Pranav

erichshiino
Partner - Master
Partner - Master

Hi, I changed the macro a little bit.

Hope it helps,

Erich