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

Excluding List Box Members

Hi,

Please take a look at the attached sample file. What I want to do here is to take the selected elements in the X alternate state "CodesToExclude" list box and then exclude (gray out) the corresponding fields in the default state 'Code' list box for ever and for every  default field selection/deselection onwards. So for example if 3 and 5 are selected in the CodesToExclude list box, values 3 and 5 should always be grayed out in the 'Code' list box, even if user clicks the 'clear' button, or selects the A store from the Store list box which normally would have the 3 and 5 Code values as 'possible' selections.

The grayed out or blocked Code field values should stay in effect until user deselects them from the CodesToExclude list box.

1 Solution

Accepted Solutions
JonnyPoole
Employee
Employee

How about if you change the list box to an 'expression' and enter this expression:

=if(  SubStringCount( '$(vExcludeList)' ,Code) = 0 , Code)

Where

vExclude list is a variable with this defintiion:    =concat( distinct {X} CodesToExclude,'|')

To prevent users modifying the list box i added a transparent text box over the top.

Capture.PNG.png

View solution in original post

8 Replies
JonnyPoole
Employee
Employee

Here is a solution that uses the field lock capability (shows blue) so that 'Code' in the default state cannot be cleared or changed by the user unless they adjust or clear the 'codestoexclude' box on the right.  With locking, instead of green the current selections show blue. 

It uses a series of actions do this tied to a field trigger on the Code field (as you started) as well the clear X state button.

Capture.PNG.png

Not applicable
Author

Is this the only way to implement this? Another words, instead of locking the 'Codes' field and graying out in it what is selected from the 'CodesToExclude' list, would it be possible to remove those selections all together from Codes? Sort of like calculated dimensions a for a chart object?

JonnyPoole
Employee
Employee

How about if you change the list box to an 'expression' and enter this expression:

=if(  SubStringCount( '$(vExcludeList)' ,Code) = 0 , Code)

Where

vExclude list is a variable with this defintiion:    =concat( distinct {X} CodesToExclude,'|')

To prevent users modifying the list box i added a transparent text box over the top.

Capture.PNG.png

Not applicable
Author

Thanks for your suggestions. I think I got it working properly. I had to add the following set analysis to every expression so that when nothing is selected from the Codes list, the hidden codes would not come into play:

sum({<Codes-={$(vExcludeList)}>} quality)

andreas_koehler
Creator II
Creator II

Jonathan,
I am very interested in this solution but I sadly can not figure out where exactly you put in

=if(  SubStringCount( '$(vExcludeList)' ,Code) = 0 , Code)

I am not yet familar with expression in list boxes but I thought that it would be in the formula of box "Code".

But it is not.

I also do not see the definition of vExcludeList.

Can you help?

Thanks

Andreas

JonnyPoole
Employee
Employee

hi ! its been awhile since i was active on community but here goes...

my questions for you are:

1. Are you working with Qlik Sense or QlikView ?  The solution is valid for both . In QV , you can edit the properties of a list box and change the field. At the bottom of the list of fields is <expression> which allows you to write an expression.  In Qlik Sense, you can do something similar except that we don't have list boxes we have 'filter panes'. Select the filter pane and on the right you will see an f(x) area to change the field to an expression

2. In the posts above i did write the definition of the variable 'vExcludeList', but i think i typo'ed the name. I called it 'vExclude list'  . 

andreas_koehler
Creator II
Creator II

Hi !

Thanks for helping me and for your quick reply.

1) I work with Qlikview. I go to the List box called Code then pane "Properties/General" and I see the list of fields. I see Code being selected and this is what should be displayed. I also see <expression> in the list . When I open it it is empty.

When I open the pane "Expressions" in the list box "Code" it is also emply. No definition is set.

I also do not see the Variable vExcludeList in the variable overview.

When I look into the expression overview only the expressions of the 2 textboxes are displayed.

So I wonder where all the code is.

2)  That is fine. I figured that this is a typo.

Regards,

Andreas

JonnyPoole
Employee
Employee

The expression and variable is blank until you manually enter an expression of your own choice.