A neat feature of QlikView's built-in back/forward buttons is that they are available only when relevant‒i.e. when a back or forward selection is possible. This article will teach you how to create this same conditional effect in your own back and forward buttons!
- Set a "vBack" variable whenever a button that changes multiple variables is clicked. This variable should be set to a single value that would indicate the previous back state. For example, if buttons control your timeframe through the setting of several variables, and after your timeframe is set to "YTD" you change it to "MTD," the "MTD" button should set vBack to "YTD."
- Create an OnAnySelect trigger that sets vBack to null.
- Create a button with a standard Back action. Conditionally hide this button if vBack is not equal to null.
- Create a second button in the same position as the above button that is to be displayed when vBack is not equal to null. Create a series of Set Variable actions on this button, using the vBack variable to determine which ones to change. For instance, if we only want to change vTimeframe if vBack is a timeframe variable, then we can create an action on vTimeframe to say: =if(vBack='MTD',vCurrentMonth,vTimeframe). By setting an ELSE condition equal to the variable itself, we ensure that we do not modify variables that should not be affected. Note that it is this step that makes the implementation of back/forward buttons in variable-heavy applications so challenging‒you may potentially need to create hundreds of actions with conditions such as these, something that can be quite time-consuming.
Infinity Insight Demo.qvw