Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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:
ID | Category | Has-license-car |
---|---|---|
1 | Analyst | 1 |
2 | Director | 1 |
3 | Manager | 0 |
4 | Analyst | 0 |
5 | Comercial | 1 |
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:
ID | Category | Has-license-car |
---|---|---|
1 | Analyst | 0 |
2 | Director | 0 |
3 | Manager | 0 |
4 | Analyst | 0 |
5 | Comercial | 0 |
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.
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')
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
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,
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?
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.
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
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)
instead creating formula in list box, create it in Script and you will avoid this problem.
Anna
That is correct...