Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Fill listbox dynamically from a variable?

I have a variable V1 with this content: A;B

Now i want to fill a listbox dynamically depending on this variable...

Listbox:

A

B

I tried already to use the formula: =SubField(v1,';').

The first value is always shown and this one is not clickable in the listbox.

I found a solution with an Inputbox, but this one is not looking good.

Has anyone another Idea how to solve my problem?

Besides you find my *.qvw example...

1 Solution

Accepted Solutions
johnw
Champion III
Champion III

See attached for one solution.  Create a data island with a ValueSequence field:

ValueSequences:
LOAD recno() as ValueSequence
AUTOGENERATE 10; // maximum number allowed

Then use this as your list box expression:

=subfield(V1,';',ValueSequence)

Selections of values in this list box will actually select the underlying ValueSequence, which you can then use with subfield() again to find which bookmark has been selected.  You'll need to decide what to do if multiple are selected.

View solution in original post

8 Replies
swuehl
MVP
MVP

May I ask what you want to achieve with this listbox?


I believe even if you could get the variable substrings to be displayed in separate rows, you won't be able to select on them, since they are not connected to fields you can select on.

If you want to filter values from your field Value using your variable V1, you could try

=if(wildmatch(V1,'*'&Value&'*'),Value)

or something similar.

Regards,

Stefan

Not applicable
Author

Hi Stefan,

i want to use this for loading bookmarks. With a macro i read out all available bookmarks in a variable (like BM1;BM2;BM3) and i want to show them in a listbox. If you choose one value, another variable is filled with the selected name and i can load this bookmark. The Bookmark Box is no solution for me...

Regards, Martin

swuehl
MVP
MVP

Martin,

I don't think that you could select on these values, how do you want to fill your other variable?

Maybe you could use an input field and set the bookmarks to the input field values (edit: via Macro). It shoud be possible to select on those (if you use a straight table to view, one could not modify them ), not sure if the standard access methods to read out selected values of input fields work the same though.

Regards,

Stefan

johnw
Champion III
Champion III

See attached for one solution.  Create a data island with a ValueSequence field:

ValueSequences:
LOAD recno() as ValueSequence
AUTOGENERATE 10; // maximum number allowed

Then use this as your list box expression:

=subfield(V1,';',ValueSequence)

Selections of values in this list box will actually select the underlying ValueSequence, which you can then use with subfield() again to find which bookmark has been selected.  You'll need to decide what to do if multiple are selected.

swuehl
MVP
MVP

John,

that's neat, again!

Haven't thought about using a data island for that and that it will be used as the list box field.

But kind of logical, thank's for pointing to the right direction.

Not applicable
Author

John! Thanks you so much for helping me again...

To me it seems that you are Mr. QlikView in Person .

IAMDV
Luminary Alumni
Luminary Alumni

Hi John,

Very clever technique. Thanks for sharing with example.

This kind of questions really push the limit.

Thanks to everyone.

Cheers - DV

simondachstr
Luminary Alumni
Luminary Alumni

Very clever solution.

I want to take it to the next level and print out the selections I made in V1. Printing one selection is possible but I get problems for multiple selections.

I expect something like this:

=GetFieldSelections(subfield(v1,';',ValueSequence),',')

However, it's not working. Any ideas?