Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I have a list box for year, month and day.
When I select a year and a month, some of the days are white (possible) and some are grey (not possible).
When I select one of the grey days, I loose the selection of the year and/or month.
Is there a way to disable/grey out the days that are not possible in the list box (make them unselectable).
I know you can set 'Hide excluded', but that is not what I want.
St0ny
This seems to work if you make it your list box expression.
aggr(MyField,Myfield)
Thank you John,
My listbox is like this (red is white):
1 2 3 4 5 6 7 8 9 10 ...
The red ones are possible days to select. When I use your solution the listbox shows only the selected day.
I almost have what I wanted by checking the Show alternatives setting.
When I select 4 this is what I get (blue is yellowish):
1 2 3 4 5 6 7 8 9 10 ...
The 'problem' is that I can still select the grey values and not just the blue ones.
Screenshot from my QlikView document:
St0ny
I think the basic rule is that if you can see them, you can select them. So you can hide excluded, or remove them completely, but there's probably no simple way to make gray values unselectable.
Maybe build a macro that stores the currently-possible values for the days in a variable, triggered on any selection. When they make a selection in the days field, see if any selected values are NOT in the variable's list. If so, undo the selection with activedocument.back. I suspect that would restore any selections wiped out as a result of the "illegal" selection. It's not quite as friendly as simply protecting the gray values, but the net effect should be the same.
Or maybe make a small transparent text box to fit over each day, and put them in the top layer, and don't allow move/size of them or the list box. Set as a display condition for each text box that the day it's covering is not possible given the current selections. That might be a bit more difficult, but it doesn't require a macro, and seems more user friendly.
I can fiddle with it if you can't work something out.
Hello John,
It's not a showstopper, I was just wondering.
The second option looks promising to me, can you give me a hint of how this condition would look like.
St0ny
I ended up creating an example while thinking about how to handle it. The conditions in my example look like this:
index(concat({<Date=>} Date,','),'12/7/2011')=0
It seems to work, or at least do what I think you're asking for. It's not exactly your data, but should be easy to adapt.
Edit: Now that I'm seeing this, it seems like it should just be a selectable option. I've had users that would probably prefer this behavior, as they really hate it when QlikView changes other selections, but don't want to constantly lock and unlock selections to prevent it.
Edit: Interesting! If you control click, or drag to select, you can select values in the gray even though they're under the text boxes. It does require you to select at least one already-possible value to START, but then you can control click the possible value(s) off again, and you end up making selections UNDER the protective text boxes, and therefore clearing other selections in the document. So it's not perfect.
Hello John,
Sorry for the late reply, I live in the Netherlands (time difference).
Thank you for the effort you made. Your first edit explains the reason why I wanted this.
I have implemented it in my QlikView document and it works.
So now I can explain it to the people who have to work with it.
St0ny
I made a variable
vDateString = Concat({<Date=>} Date,',')
and changed
= Index(Concat({<Date=>} Date,','),'12/5/2011')
into
= Index(vDateString,'12/5/2011')
Is it possible to get the value of an item in a list box by its index ?
Then I can replace the hardcoded date in a 'function' with an index.
Something like this
= Index(vDateString,ValueByIndex('LB01',1)) // for the first value in the list box
= Index(vDateString,ValueByIndex('LB01',2)) // for the second value in the list box
...
St0ny
When I try
= Pick(1, Concat({<Week=>} Date,',')) // I want, in this case, the first date in the list box
I get the whole list with dates.
When I try
= Pick(2, Concat({<Week=>} Date,',')) // I want, in this case, the second date in the list box
I get an empty string.
What am I doing wrong ?
Try
= Pick(1, $(=chr(39)&Concat({<Week=>} Date, chr(39)&','&chr(39) ) &chr(39) ) )
encapsulating each value in your concatenated list in single quotes and put all in a dollar sign expansion.