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

Pass Field Name to get list of available field values in List Box

Hi Sense community, 

I have a requirement that I should show list of field names on one List Box and upon selection of one value (which is the Field Name) the other List Box will show the values that are in the selected Field.

For example,  imagine I have a data model with table like below:

CountryRegionTeamGroupCCDivision
USARegion 4Team2GA1200II
CanadaRegion 3Team1GD1450III
IndiaRegion 2Team2GC4586I
South AfricaRegion 3Team1GC2252IV
SpainRegion 1Team2GA1020I
MexicoRegion 5Team4GR5620V
GermanyRegion 2Team5GV2000VI

 

The First List Box will have the list of selected Field Names. One value can be selected and data will not be filtered at this time.

Country

CC

Group 

Team

Second List Box will populate the list of field values for the selected field in the First List box. Assuming "Group" is selected, in the Second List box I need to see and be able to select from the list below to filter the data. 

GA

GC

GD

GR

GV

Thank you 

2 Solutions

Accepted Solutions
msKarthikeyan
Employee
Employee

Hi Alex,

For the first listbox you need to create a island table with the fields required.

This is the code for generating all the fields

For t = 0 to Nooftables() -1
For f = 1 to NoOfFields(TableName($(t)))
tables:
Load
TableName($(t)) as table_name,
FieldName($(f),TableName($(t))) as field_name
Autogenerate 1;

Next f
Next t;

 

For the second filterbox:

you can use the expression:

=GetFieldSelections(field_name)

 

-Karthik

View solution in original post

Vegar
MVP
MVP

4 Replies
msKarthikeyan
Employee
Employee

Hi Alex,

For the first listbox you need to create a island table with the fields required.

This is the code for generating all the fields

For t = 0 to Nooftables() -1
For f = 1 to NoOfFields(TableName($(t)))
tables:
Load
TableName($(t)) as table_name,
FieldName($(f),TableName($(t))) as field_name
Autogenerate 1;

Next f
Next t;

 

For the second filterbox:

you can use the expression:

=GetFieldSelections(field_name)

 

-Karthik

Vegar
MVP
MVP

See attached qvf

image.png

 

Alex78
Contributor III
Contributor III
Author

Thank you Karthik.

It works with little update on the second filter.  =[$(=GetFieldSelections([Filter Field]))] . I copied the expression from Vegar's suggestion.

 

 

msKarthikeyan
Employee
Employee

Ok Thanks Alex. Noted