Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
mattphillip
Creator II
Creator II

Defining a listbox field using a drop down selection

Hoping someone can help with this. I'm looking for a way to capture the current selection of a drop down box (populated with field names) to feed into a listbox which will display all the available values within that field. In my mind this should be possible although when I specify the listbox field as an expression (=GetFieldSelections(<FieldName>)) the listbox only displays the name of the field and not the values.

Can anyone help?

Appreciated.

Matt

9 Replies
swuehl
MVP
MVP

You can create a list box using system field $Field and a second list box with a calculated field (<expression>):

=[$(=Only($Field))]

You can use your variable instead of $Field, that should also be possible

mattphillip
Creator II
Creator II
Author

Hi Stefan,

Thanks for your reply, although I think I need to clarify what I looking for. I want to be able to make a selection from a drop down box (which contains a list of fields - contained with a user created field and not the system $Field) and then when the user selects a field, a separate list box displays the values within that field.Does this make sense?

Thanks,

M

swuehl
MVP
MVP

Hi Matt, and your drop down box is built on an input box to change a variable? Assuming the variable is called vVar, then just use a field <expression> in your list box like

=[$(=vVar)]

The trick is to use a dollar sign expansion to replace the expansion with the field name,  before the expression gets evaluated.

mattphillip
Creator II
Creator II
Author

Hi Stefan,

Thanks for the suggestion but I've tried it and it doesn't work. There's an error in the expression.

Any thoughts?

M

swuehl
MVP
MVP

Seems to work for me. Don't get misled by the syntax checker without actually verfying that the expression is not working.

mattphillip
Creator II
Creator II
Author

Hi Stefan,

I did check whether it works and it doesn't seem to for me. I've attached my file. Could you take a look?

Appreciated.

M

swuehl
MVP
MVP

Can't see the fields you can select in your data model...

mattphillip
Creator II
Creator II
Author

I'm not sure what the problem is. The field names are stated in an inline table in the script and loaded into the drop down menu (the field name values are contained within the 'NewFields' field. The textbox confirm that its storing the currently selected drop down box value, whilst the listbox remains blank rather than displaying the field values.

The field names are visible for me.

swuehl
MVP
MVP

No, I mean I can't see all the fields you can select from the drop down in your data model (table view).

For example:

Age of August

I can only see one table, FieldMapping, with two fields.

to see the values of all the fields you can select, these need to be part of your model.