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: 
Corfiz
Contributor II
Contributor II

Always one selected value WITH VARIABLE

Hi,

I need to set a date field to "always one selected value", so that only one single value will be selected at all times. I've seen the excellent QlikSense help video on that subject (https://help.qlik.com/en-US/sense/February2024/Subsystems/Hub/Content/Sense_Hub/DataSource/select-si...), so I know how that is done. 

My problem is that I need to alwas set it to the "current date" on opening. The current date is written in a variable, or I could use today() - but neither of those work with the bookmark I'd have to use according to the video.

Does anyone have any ideas? The only one I come up with is resorting the calendar-table in some weird way, so that the current date would be the first value in the table and so the automatic selection - but if there was an easier way to set it to a variable value, I'd much prefer it.*

Thanks everyone!

*Edit: I'm not even sure that would work, because "the first value in the dimension" wouldn't necessarily mean "the first value by loading order", it could also be "the first value according to our sorting order, which is numeric for a date field"

Labels (3)
6 Replies
ACorona
Contributor III
Contributor III

Have you tried using an action on the sheet level to either "apply a bookmark" or "Select values in a field". You could either use the bookmark that is holding your current day selection or just add your variable to the value section in "Select values in a field"

ac12233_0-1712699768528.png

 

Corfiz
Contributor II
Contributor II
Author

Hi, thanks for the reply! The problem with that is that I don't think it would work with the "Always one selected value" option - you set that on the field level in the field properties - and the default selected value when you open the app is apparently always the first one in the dimension. 

Also, if I apply that action to every sheet, the users will go nuts, because their date selection will be reset whenever they switch sheets. 

ACorona
Contributor III
Contributor III

10-4, Another option would be to create a new field in your script that would either hold the current date or a flag field that has a 1 applied to the current date. Use that new field as your "Always one selected value" option.  

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @Corfiz 

It is possible but there are specific steps you need to take to do it:

  1. remove "always one selected value" from your field and clear selection
  2. create default bookmark using "advanced search" option - note that for this to work you will need to use set analysis to ensure it will still work when "always one selected is still" applied"f, or example:
    1. =Only({1}Year)=Max(Total {1}Year) Make sure bookmark is set when there is more than 1 value available (always one selected value disabled)Adjust the formula to your fields and search criteria

  3. Test
  4. RE-apply always one selected value and test again

The point i highlighted in RED is critical - if you leave "always one selected value" on when doing it then bookmark does not store search formula but single field value which is not going to work

cheers

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
Corfiz
Contributor II
Contributor II
Author

Hi Lech,

thank you so much for your help, and sorry for asking again, but I can't edit the expression in my bookmark, only the name. Is there a trick to it?

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @Corfiz 

Well - you dont need to edit expression in bookmark. You need to create one from scratch using advanced search option to apply default filter. Here you have video about the process:

https://youtu.be/tFyqOigqnUw?si=TnYz7funH5Bz9O1U

cheers

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.