Leverage the power of inputfields to automatically take each user back to the views/selections he or she uses most. This tip is sure to win you popularity contests!
QlikView's native "Session Recovery" capabilities have been a source of frustration to me for years. For those unfamiliar with it, I'm referring to this little QlikView Server setting, which in enabled in default QVS configurations:
My concerns with Session Recovery are threefold:
- It's all or nothing: it applies to all applications hosted by the server
- It's all or nothing: it applies to all fields/variables in the application
- It's fairly buggy, especially when data changes (such as when a data point disappears after a periodic data reload)
Fortunately, with a little creativity, we can overcome all three challenges and provide vastly improved "Selective session recovery" functionality. We achieve this through the magic of QlikView inputfields. An inputfield is a field that "sticks" (is preserved) between sessions. Traditionally, these special fields have not exactly stolen the show; when they are used at all, it is usually in a very limited way, such as for setting user-specific budget or goal data. But...
What Connery is referring to is that a simple macro (yes, it does work in AJAX, glad you asked!) can be used to automatically set inputfield values behind the scenes. We can leverage this to selectively preserve both key views and key selections between sessions. Feel free to download the application below for a full demo of what is possible.
At a high level, here's what happening:
Each button sets 2 variables. The first indicates what you are changing (e.g. Measure) and the second indicates the value you are setting (e.g. TRx). Once the variables are set, the button calls a macro which looks for the corresponding row in the helper table box found on the Main sheet and sets the relevant inputfield value. Button coloring and conditional object hiding is controlled through a simple QlikView expression that checks the relevant inputfield value.
We can leverage inputfield functionality to preserve across sessions only those field selections that we choose. In the above application, for example, only field Product is preserved. Preserving field selections requires a 2-step approach. In the first step, we add an OnSelect field trigger, which sets the 2 variables mentioned above and calls the same macro. The value of the second variable is set using functions getselectedcount() and concat(). In the second step, we create an OnOpen document trigger to select field values using the relevant inputfield value, which QlikView knows about even before the OnOpen trigger fires.
The "reset default view" button in the top-left corner calls a separate 2-line macro that simply resets the inputfield to the default value, which is the value that is defined in your load script. The only other thing it does is restore field selections to their default states.
With this approach, we can disable the native Session Recovery setting altogether, and customize what we consider to be "session recovery" for each application, which will be preserved even if the "last document state" is cleared in the QlikView AccessPoint. In almost every case, this will save your users at least one click (if they happened to have enough foresight to have created a bookmark) and often many more (if they didn't), letting them focus on getting the analytics they need without worrying about re-setting their application settings at the start of every session. This will absolutely lead to a better user experience, happier users, and improved application adoption. Happy Qliking, guys.