60 second trick saves hours debugging Qlik Sense apps
During the past weeks I have developed what has turned into a fairly complex Qlik Sense solution, where reloading the main application takes on the order of 10 minutes.
I know — Qlik apps should be kept small, with intermediate data sets stored as QVDs. But sometimes that’s just not practical.
Qlik apps works the same as most apps — if you made a typo somewhere the reload (or compilation for regular computer applications) will fail. Sometimes after a few seconds, more often right towards the end, just before those 10 minutes have passed… Fix the typo and start another 10-minute reload. Sigh.
The other day I realised that I had been using an old trick without even thinking about it, to cut down the reload times from 10 minutes to a few seconds. Talking to some colleagues, it turned out they didn’t use this trick — so here it is: The best time saver ever for Qlik developers.
The idea is very simple: You want to run the entire load script to make sure it works, but without processing 100s of megabytes of data or more.
In Qlik scripting, this is achieved by using the First prefix, added before a Load statement. Two things needed:
- Add a variable at the beginning of the script, and make it easy to change it to a few different values (for loading 1000 rows of source datasets, or something larger).
- Add the variable before all load statements where large datasets are loaded into the app.
It can look something like this:
Sense’s load script editor does not quite like using variables in this way, and complains about the syntax being incorrect. Don’t worry about that, the script loads fine.
To do a quick load (to ensure the script is solid from a syntax perspective), just enable one of the commented out lines at the top. This will limit the numer of lines loaded in the following load(s). The load time will be nice and short.
Once the script works, comment out that first variable again, setting it to an empty string. All data will be loaded from sources.
Easy trick — I know. But it has literally saved me days during past months!
Originally published at Ptarmigan Labs.