Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Setting Default values in List box

Hi,

I have 5 years in a list box as below.

Year.PNG

I want 3 years to be selected by default i.e. 2016,2017 and 2018 and in clear all button.

I am trying to put action on clear all and giving field name and expression but it is not working.

Also I referred the below link in community.

Setting default values in List box | Qlik Community

But its not working for me.

Please help with possible answer .

Thanks.

3 Replies
Chanty4u
MVP
MVP

Try using an OnOpen trigger in Document properties settings with action Select in field,

Year

as field and

(2017|2018|2019)

as search string

dapostolopoylos
Creator III
Creator III

My approach on a similar occasion where i wanted my app to open with selected the lasta four years, including the current, was this:

I added this code in my script:

Tmp_Year1:

LOAD

     Distinct Year

     Resident

     SalesMasterDataCU

Where

     Num(Year) >= if(Num(Month(Today()))=1,Year(Today())-1,Year(Today()))-3    

     and

     Num(Year) <= if(Num(Month(Today()))=1,Year(Today())-1,Year(Today()));

Tmp_Year2:

LOAD

     Concat(Year,'|') as YearS

Resident

     Tmp_Year1;

Drop table Tmp_Year1;

LET vYearsSelected=Peek('YearS',0,'Tmp_Year2');

Drop Table Tmp_Year2;

Then i added an OnOpen action in my app like this:

Capture.JPG

In your case if you want to add an action on the Clear All event you should add an On Change action (and possibly an On Select action) on the Year field chcking with GetSelectedCount() function if the Year field if there are any selections in order to activate the default selection.

Father/Husband/BI Developer
Anonymous
Not applicable
Author

It is not working for me.