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

Always show list box

I have a list box with "Windows Checkboxes" as selection style.

This list box has an expression defined like below:

=if([Has-license-car]=1,'Has license car')

Field [Has-license-car] is a bit type (0 or 1) that is loaded from a SQL table:

IDCategoryHas-license-car
1Analyst1
2Director1
3Manager0
4Analyst0
5Comercial1

When I check the list box this only shows personal that has license car. Otherwise it shows all the personal.

The problem here is when I have a table like below in which all "Has-license-car" values are 0:

IDCategoryHas-license-car
1Analyst0
2Director0
3Manager0
4Analyst0
5Comercial0

In this case since all "Has-license-car" values are 0 then list box is never shown.

So what I am trying to do is to always show the list box even if all "Has-license-car" values are 0.

10 Replies
trdandamudi
Master II
Master II

I am not clear on your requirement.. Are you looking for the below expression:

=if([Has-license-car]=1,'Has license car','Has license car')

john9inno
Creator
Creator

is that a listbox?

then

Get rid of Expression. then choose field "[Has-license-car]" as a list box field.

that will show you all values.

thanks.

John

Not applicable
Author

Yes, it is. But doing what you indicate, creates a listbox with two choices, 0 or 1. I do not want to show a list with the two possible values, I mean, I only want to show a checkbox with one choice titled "Has license car" and when you check it filter data the rows of the table which has "Has-license-car" set to 1 and when you uncheck it, it does not filter data on the table, it takes into account all the values with "Has-license-car" field set to 0 or 1.

In conclusion,

Not applicable
Author

Yes, my problem was that when there were no rows in table with "Has-license-car" field set to 1, the checkbox was disappearing.


The goal of this checkbox was the following:

When you check it filters the rows of the table which has "Has-license-car" set to 1 and when you uncheck it, it does not filter data on the table, it takes into account all the values with "Has-license-car" field set to 0 or 1.


With the expression that I was using in the list box it was working and filter data correctly, the only problem was that checkbox (list box) was disappearing when all values on "Has-license-car" field were set to 0.


So now, using your expression, checkbox will always be visible and data in the table will be filtered correctly according to the value of the checkbox (checked or unchecked). If checked data on table will be filter according to "Has-license-car" = 1, otherwise (if unchecked) no data will be filtered (all data in table will be taken into account independently if its values is 0 or 1), right?

jonathandienst
Partner - Champion III
Partner - Champion III

Your explanation is rather confusing. I suggest that you upload a small sample qvw file that illustrates the problem.

Otherwise trdandamudi's suggestion looks correct to me - that should meet your requirements described above. Otherwise, perhaps you need a button and a variable, but its hard to say on the information you have provided.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
avinashelite

Could you please upload a sample app with your requirement and the problem your facing so that it would be helpful for us to understand

vcanale
Partner - Creator II
Partner - Creator II

Hi,
Try to use an expression instead of the field in the General tab - List Box Properties
Eg: =if(Has-license-car=1, 1, '')
Similar expression in the Layout condition if you want to see the List Box only for the Has-license-car=1:

=if(Has-license-car=1, 1, 0)

annafuksa1
Creator III
Creator III

instead creating formula in list box, create it in Script and you will avoid this problem.

Anna

trdandamudi
Master II
Master II

That is correct...