Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
splitcore
Contributor III
Contributor III

Why is my Multi box displaying a single 0 at the top of the drop-down list?

Hi guys

I am new to Qlikview still so I apologize if any of the following may seem completely wrong in some senses to you guys...

I'm having an issue with my multi boxes which is the following:

I have two multi-boxes that work with a Year field (Just a table named Year containing years 1950-2015). One to select (From Year) and the other to select (To Year) which creates a range in my other objects. What I tried to do was if someone selected 1980 in (From Year) multi box, all years including and prior to 1980 should not be displayed in the (To Year) multi box.

The expression I used in the (To Year) multi box to get it to do this is as follows:

aggr(SUM({<Year=>}if(Year>$(vStartYear),Year)),Year)    

//If a value is selected in (From Year) m-box a trigger sets vStartYear to that selected year so I can use it in other expressions like this one.

This causes the multi box to display only Years >1980 but at the top of the drop-down list is a single 0....

_________________

|Year     |         0      |

            |     1981     |

            |     1982     |               //Visual "HD" representation of the multi box in drop down state.

            |     1983     |

            |     1984     | ..........


As the Dimension is an expression I do not have the option to tick Ignore Null in the presentation tab because the dimension is not listed on that tab at all.

I have tried the following to get rid of it in my dimensionexpression...


aggr(SUM({<Year=>}if(Year>=$(vStartYear) and Not Match(Year,'0'),Year)),Year)

aggr(SUM({<Year=>}if(Year>=$(vStartYear) and Not Match(Len(Trim([Year])),'1'),Year)),Year)

//Len(Trim('Year')) cannot be a 0 even a 0 would give a result of 1. All other years would give a result of 4.

aggr(SUM({<Year=>}if(Year>=$(vStartYear) and Not Match(Year,'0'),Year)),Year)


But the 0 remains where it is...


Note the 0 is NOT in my table. It is something that is created by my Dimension expression I'd have to assume, but this is the only way I could find to filter the drop-down options in my m-box...

Please assume that all other problems this might have, have already been addressed like nothing would be displayed in (To Year) m-box if nothing was selected in (From Year) m-box. I have only provided necessary information relating to the "0" issue so as not to complicate things further. This is what the client requested I know there are alternative ways of doing something similar. 

Again I could not find a way to limit the data a multi-box displays so I experimented and found this way to be the only way I could find that even works correctly. (Except for the pesky 0 on top of course)

So if someone could either suggest an alternative method to limit the m-box Years displayed to be greater than my variable vStartYear, or a way to get rid of the "0" at the top of the drop-down list to solve this problem that'd be wonderful.


Kind Regards


1 Solution

Accepted Solutions
swuehl
MVP
MVP

Try

if(Year>$(vStartYear),Year)


or


aggr( if(Only({<Year= >} Year) >$(vStartYear) ,Year), Year)   

View solution in original post

4 Replies
swuehl
MVP
MVP

Try

if(Year>$(vStartYear),Year)


or


aggr( if(Only({<Year= >} Year) >$(vStartYear) ,Year), Year)   

splitcore
Contributor III
Contributor III
Author

Thanks Swuehl...

Both your solutions worked 100%

It was something so basic... I thought I had tried the 1st one already but apparently not.

I did get it to work with the following as well:

if(aggr(SUM({<Year=>}if(Year>=$(vStartYear),Year)),Year),Year)      //no more 0 in dropdown etc

But obviously the one you suggested is a lot simpler and easier on resources etc...

Thanks for the quick reply and accurate answers!

splitcore
Contributor III
Contributor III
Author

Even though I now got it working I'm now wondering if there's a better way of managing my m-boxes...

Currently I have 4 m-boxes (2 for each selection of from year and to year each with a conditional show)

When no selections are currently made the conditional show, shows the two standard m-boxes which only contain Year as Dimension so the user can select any Year in either m-box to start with. However when either a value from (From Year) m-box or (To Year) m-box is selected, the other m-box becomes hidden and the filtered m-box takes it's place which would only display Years post or prior to the 1st selection made depending of course in which m-box the selection was made. Is there a way to only use one m-box for each selection? Everything works nicely I just think the less object there are and the less conditional show expressions etc the more memory friendly the application becomes...

swuehl
MVP
MVP

Not really sure if I understand your setting, could you upload a small sample QVW?