Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have 5 years in a list box as below.
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.
Try using an OnOpen trigger in Document properties settings with action Select in field,
Year
as field and
(2017|2018|2019)
as search string
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:
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.
It is not working for me.