You might think that there is not much to say about buttons in QlikView. If so you are probably not thinking much beyond a shiny lozenge of a thing that invites you to Clear Current Selections. I’m here to convince you otherwise.
Don’t Waste Space
The first thing to say here is that a Clear Current Selections button is totally redundant. That button is built right into the QlikView UI in Desktop and both Access Point versions. The same is true of Back, Bookmarks and (unless you have hidden your tabs) Next and Previous Tab buttons. Save yourself some space for some more analysis and don’t waste space with these buttons.
In my opinion shiny lozenges take far more space up than they need to and are visually distracting. You should not use these unless you really have to (i.e. your client or user insists).
Many objects can be Buttons
Anything that supports Actions can be a button. The lowly Text Area serves this purpose admirably, and if you have to use a gauge in your app, at least make it useful by making it clickable. A text box with no borders or shading provides a clickable line of text – like the ones that have served web pages so well for many years now.
With the use of dynamic colours you can have traffic light dashboard components that can also be useful for triggering actions (such as a dive to detail). Simple shading behind your text can make a useful toggle switch in your app.
Using Actions For Hiding Sheets
Here are some examples of text boxes performing the actions of buttons. These examples place values into variables, which are then used to do something dynamic in the app.
In most of the QlikView apps I produce I have some tabs for system data that is hidden from most users. To implement this I set a variable in the load script:
let vShowDev = 0;
On the front sheet there is then a text box that has dynamic text:
=if (vShowDev = 0, 'Show', 'Hide') & ' Development Tabs'
And finally there is an Action to set the value of the variable:
=if(vShowDev = 0, 1, 0)
The toggle on the screen looks inconspicuously like this:
All that is left then is to put the Conditional Show criteria on the correct sheets. The code for this is simply:
vShowDev = 1
Show Different Views Based On Variable Values
Another example of a show/hide toggle is where you want to swap between different charts or tables. Natively QlikView has the Auto-Minimise tick box and more recently the Container, but I am not a fan of using these. With a Conditional Show one object can be hidden and be replaced with a number of other objects.
To do a multi-way toggle I will set color variables up in the load script:
let vColHighlight = rgb(210, 255, 210); let vColNoHighlight = rgb(255, 255, 255);
And default a display variable:
let vViewMode = 'Dashboard';
Text Areas are then required for each of the values you wish to set. Each text box simply has the legend of the view mode, and an Action to set the variable to the correct value:
The final step is to highlight which button is presently active. This is done by setting the Background Colour on each Text Object to a dynamic colour with the following code:
if(vViewMode = 'Analysis', $(vColHighlight), $(vColNoHighlight))
With a bit of sizing and alignment the row of toggle buttons should look a bit like this:
Again, a simple Show Conditional expression is required on each chart to dictate under which heading it displays. The code for this will be:
vViewMode = 'Analysis'
Other QlikView Button Examples
There are many, many more examples of where using Actions on Text Objects or Gauges can be useful. Selecting a field to analyse, changing some UI feature, linking it to an external site or anything else you can think of.
I have created an app with a few examples that you may want to use in your own applications. You can download this from the Shared QlikViews section of QlikCommunity, here: https://community.qlik.com/t5/QlikView-Documents/QlikView-App-At-The-Qlik-Of-A-Button/ta-p/1484152
And you can see the app in this YouTube video here: