Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
mattphillip
Contributor

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
MVP
MVP

Re: Defining a listbox field using a drop down selection

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
Contributor

Re: Defining a listbox field using a drop down selection

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

MVP
MVP

Re: Defining a listbox field using a drop down selection

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
Contributor

Re: Defining a listbox field using a drop down selection

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

MVP
MVP

Re: Defining a listbox field using a drop down selection

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

mattphillip
Contributor

Re: Defining a listbox field using a drop down selection

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

MVP
MVP

Re: Defining a listbox field using a drop down selection

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

mattphillip
Contributor

Re: Defining a listbox field using a drop down selection

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.

MVP
MVP

Re: Defining a listbox field using a drop down selection

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.