Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
erikzions
Creator
Creator

List box expression with selection indicator

I have created a dynamic list box so I can have any amount of filters without taking up any additional space.  It works wonderfully.  The only caveat is that it does not indicate when a selection has been made on a field, the way a list box or multi box would. I have tried my best to make a getcurrentselections function work on a dynamic field. 

Is there a way to put an indicator in an expression to show if there is a selection has been made?

Included is a dummy example file.

1 Solution

Accepted Solutions
Anonymous
Not applicable

Eric, I am now using this expression in my List Box:

=subfield(
left(
mid(GetCurrentSelections('|','~'),index('|' & GetCurrentSelections('|','~'),'|' & only({1}$Field))),
index(
mid(GetCurrentSelections('|','~'),index('|' & GetCurrentSelections('|','~'),'|' & only({1}$Field)))&'|','|')-1)
,'~',2)

For sorting I use:

=index('|' & GetCurrentSelections('|','~'),'|'&only({1}$Field))

As Field I use $Field, so that my List Box currently shows all avilable fields and if a selection is made you can see the selection in the expression.

Regards

Norbert

View solution in original post

4 Replies
swuehl
MVP
MVP

Not exactely sure what you are asking for, I do see the selection on value male as in a normal list box:

2016-06-11 00_35_52-QlikView x64 - [C__Users_Stefan_Downloads_Dynamic Filters.qvw].png

Anonymous
Not applicable

Eric,

try this expression

=concat({1}
aggr( concat({<_FilterField=>} if(_FilterField='email', GetFieldSelections(email),
if(_FilterField='first_name',
GetFieldSelections(first_name)))),_FilterField))

in your "Field to Filter On" List Box. This will display the selections made in all the fields.

If you don't have too many fields, this could be a solution.

I think $ sign expansion will not work as it is executed "too early".

Regards

Norbert

Anonymous
Not applicable

Eric, I am now using this expression in my List Box:

=subfield(
left(
mid(GetCurrentSelections('|','~'),index('|' & GetCurrentSelections('|','~'),'|' & only({1}$Field))),
index(
mid(GetCurrentSelections('|','~'),index('|' & GetCurrentSelections('|','~'),'|' & only({1}$Field)))&'|','|')-1)
,'~',2)

For sorting I use:

=index('|' & GetCurrentSelections('|','~'),'|'&only({1}$Field))

As Field I use $Field, so that my List Box currently shows all avilable fields and if a selection is made you can see the selection in the expression.

Regards

Norbert

erikzions
Creator
Creator
Author

That looks perfect!!!  I am not going to display the actual selections, just an asterisk.  But this gets me what I need.  Your awsome, thanks.