In this article by Roger Stone and Andrew Dove, the authors of the book, QlikView Unlocked, we will cover the following key topics:
- A bit more about license types
- Making yourself comfortable and productive
- Never lose your work
- Some useful global settings
- Some best practices for developers
- Hidden features – Easter eggs
- A few do’s and don’ts
(For more resources related to this topic, see here.)
A bit more about license types
Qlik provides several ways of licensing the desktop version for developers. In this article, we’ll explain the differences and what you as a developer should be aware of.
From a developer’s point of view, there are three types of license that will enable you to create and modify QlikView documents. However, only two of them are useful once you pass the initial experimentation stage. The three types we will review here are Personal Edition, Stand Alone (Local Client), and Leased License (Named User).
How to do it
Qlik encourages potential users to try out QlikView by allowing anyone to download a free copy of Personal Edition. This is a full-featured development environment, but its usage is restricted to documents created with this copy of the software along with a handful of QlikView demonstration documents. This means that it is only of use in an environment where you are both the sole developer and user. However, Personal Edition can be upgraded to a full Local Client developer version on the payment of a fee.
To use QlikView for any corporate or collaborative development, you need either a Local Client or Named User license.
The Local Client version is completely unrestricted in that QlikView documents can be modified or created with it and deployed to internal or external users or customers. If you are a freelance developer, this is probably the version you want, unless you can afford to step up to a server version with Named User licenses.
One area that can cause some confusion is upgrading Personal Edition to Local Client.
The Help menu has an item called License Update, which might lead you to think that this is where to input the license key that you are provided with if you pay to upgrade. In fact, this is completely the wrong place and to input your license key you need to click on Settings | User Preferences and then on the License tab. Clicking on the Change button will bring up a window where you can input your license key and control number:
Finally, in most corporate environments, you will most likely lease a Named User license locally from QlikView Server. This is done by installing Personal Edition on your PC and then connecting to QlikView Server, where you are granted a Named User license, and opening a document there. This effectively means that your Personal Edition version becomes a Local Client desktop developer’s version. Note that you cannot be granted a license from a Test server; it must be a “full” server, which is Small Business or Enterprise Server.
To verify that you are leasing a license from a particular server, go to QlikView Start Page. Under Resources, there is an item called License information. Clicking on this brings up a License information panel similar to that shown in the following screenshot:
Note that in versions prior to QlikView v11.2 SR7, the license details are shown at the top of the Start Page screen.
Remember that you need to reconnect to the server at least once in every 30 days in order to renew your license. As long as your desktop version has access to the server, this will happen automatically, and you will not need to open the server connection window.
Make yourself comfortable and productive
It’s all too easy to just start using the developer environment without really thinking about how to make it work best for yourself.
Before starting on a new development, especially with a new installation of the developer environment, spend a few minutes setting things up to suit your own style and development needs. Simple things such as having more recent items in your start menu can save time as you would not have to navigate your way to a document every time you need to open it. Here, we will explore a few of our favorite settings, all of which can save a little time here and there, making you comfortable and more productive.
It’s surprising how much difference a few little adjustments to the developer environment can make to productivity, but don’t forget that you want your users to be productive too!
How to do it
You can perform the following steps for this. All the settings can be found in Settings | User Preferences, on the General tab:
Most recently used files
If you are working on a lot of QVWs in a deployment—for instance, many QVD builders—change the value in In Menu to a more suitable number. This will increase the number of files shown in the list at the bottom of the File menu. The default On Startpage value is probably enough for most purposes, but we often make these two values match. Finally, always select the Show Full Path in Menu option. It does what it says; so, rather than showing a file path containing ellipses (…) to the QVWs, it shows the whole path. This is very useful when you have various versions of a QVW in different folders as it makes it much easier to select the correct one.
Perhaps more of a styling option than a developer’s choice, this is nevertheless a handy feature. By default, QlikView presents data in a listbox without any kind of checkbox, so making individual selections requires the user to hold the Ctrl key while selecting. Using one of the other options, such as Windows Checkboxes means that the Ctrl key doesn’t have to be used; individual selections can simply be ticked. If you have a long list of values, you and your users may prefer to use a checkboxes option:
Although there are several options in search settings, in our opinion, the only one that you need 99 percent of the time is wildcard search. Using this option opens a search box with two asterisks (**) with the cursor between them. Users always search with partial data, so we don’t see why you would use normal search, which requires an exact match. On rare occasions, you might use fuzzy search, but wildcard search covers almost every eventuality. Note that fuzzy search can’t be set from the General tab but from within a search object. The desktop help incorrectly indicates that fuzzy search is an option in the General tab (as at QlikView v11.2 SR9).
Max values in current selections
This is another option that arguably has more to do with styling but can make development easier. Selecting a higher number has the effect of changing the display in the Current Selections box. By default, QlikView shows the selections of a field as, for example, A1, A2, or A3. Once the threshold of Max Values in Current Selections is exceeded, the Current Selections box shows something similar to “7 of 290”, rather than the actual selected values. By increasing the value of Max Values in Current Selections, more actual values are shown. A slight downside is that this might very quickly take up all the space in the Current Selections box, so take care if you have fields with long values in them. It’s worth pointing out that this setting does not affect the GetCurrentSelections() function, but you can pass this a parameter to get the same effect.
Never lose your work
It’s happened to all of us. Change the script and reload the document…and the script fails, wiping out all your changes.
For those of you who already write QlikView script, how many times have you made changes to the script and reloaded, only to find that there is an error and the reload has stopped? The document is cancelled and reloaded to an old state, losing your most recent changes. To prevent this annoying problem, there is a simple user setting you can make.
How to do it
Here’s what you can do. Select User Preferences from the Settings menu and click on the Save tab. Look for the Save Before Reload checkbox and select it. This will save all your changes before the script reloads, and they will still be there even if the script fails:
There are a couple of extra options you may want to set here as well.
Save Auto Recover Info performs an auto save every x minutes in a temporary file. Should your system crash, you will at least have a copy at the saved point. We recommend that you set this option to every 60 minutes or less. Bear in mind that while the save takes place, the developer system will be unresponsive; for large applications, this could be a minute or more. Balance the frequency of saves against the time it takes to do them.
The other option is Use Backup with the Keep Last x Instances option. Upon setting this, QlikView will automatically keep the last x number of QVWs. Every time you do a save (or reload, if Save Before Reload is selected), QlikView saves the current QVW, prefixing the name with “Version x of ……” and incrementing the x value with each new save. The current document is then saved as normal. If there are now more than x version files on your system, the oldest one will be deleted to ensure that only x versions of the files remain. Setting this value to 4 or 5 is about right in our opinion.
Having several instances of backups can be very useful. Sometimes, changes just don’t do what is expected, so having the ability to get back to an earlier version of your code can get you out of a hole.
We all make mistakes in the script, so when the script fails and the reload is cancelled, losing lots of changes is frustrating and time-consuming. At the minimum, always have Save Before Reload selected—it will save lots of time and frustration when the inevitable happens.
Some useful global settings
There are a handful of user settings that, by default, are turned off but are so useful, it makes us wonder why they aren’t just permanently turned on.
There are certain design options that need to be turned on in order to get the best from the developer’s workbench. These turn on extended features that allow custom formatting of cells, extended styling options such as rounded corners on objects, and debugging problems after deploying your document to a server. When a QVW fails on a server, the log file can be quite unhelpful, but one simple setting before deployment will help you find problems quickly.
How to do it
Select User Preferences from the Settings menu and then click on the Design tab. There are three options here that should be set in order to use the workbench more effectively.
Default Styling Mode
Firstly, look for Default Styling Mode on the right-hand side, and change it from Simplified to Advanced. The effect of this will be to turn on various features in the Layout tab of an object’s properties.
Chart Properties with Default Styling Mode set to Simplified is shown in the following screenshot:
Chart Properties with Default Styling Mode set to Advanced is shown in the following screenshot:
You can also turn on Advanced Styling Mode via Settings | Document Properties | General for individual documents.
Always Use Logfiles for New Documents
This option turns the Generate Log File option on in Document Properties whenever you create a new document. The log file is a very useful debugging tool when your document is deployed to a server. It is the ideal place to start looking when a document fails to reload on the server as it shows you exactly where in the script it failed and what the error was. The only drawback is that you still can’t see what happened if the failure occurred in a hidden script.
Selecting Always Use Logfiles for New Documents in Settings | User Preferences | Design saves you the trouble of remembering to select Generate Logfile in the General tab of Document Properties. You’ll always have a logfile available to help debug failures.
Always Show Design Menu Items
With this option selected, the presentation of straight and pivot tables can be altered. For example, you can change the default colors of a column, the thickness of the divider lines, or even the column header’s display properties.
Once this option is selected, right-click anywhere over a straight or pivot table, and you will see an extra menu item, Custom Format Cell. This appears beneath the existing Equal Column Width option. Click on Custom Format Cell and a new properties box will appear:
Here, you can change the appearance of a table in ways you can’t in the normal properties window:
Some best practices for developers
It’s preferable to always do things in a consistent manner, both personally and as part of a team. There are many ways to set up the QlikView environment, and if each developer chooses his own settings, this can lead to all kinds of issues and inconsistencies when you start to assemble a system.
You might consider using some of the following ideas as part of your site standards. In any event, they’re all good habits to get into. As they are all self-explanatory, we will present them as bullet points.
How to do it
- User Preferences: Always set up User Preferences the same on each machine you use.
- User Preferences: Always set up User Preferences after a new installation of QlikView or when you have a new PC.
- User Preferences: Add User Preferences to your site standards so that everyone works in the same way, especially if sharing PCs or a server.
- User Preferences: Review settings with your whole team to ensure that everyone agrees with the choices made.
- User Preferences: Check with users about styling; for example, checkboxes to select from list boxes, number of items in Current Selections, and so on.
- Scripting Engine: As QlikView can use VBScript and Jscript, establish one as a site standard as this would make maintenance easier.
- Module Code: Try to use only Safe Mode when writing Module Code as this makes the server implementation of the document easier and more secure.
- Functions: If you have functions stored in variables, keep a copy of the variable name and its contents stored in the script either as a SET function or as a commented section of code. Then, you’ll have a working copy if someone changes the function. Note that if your function contains dollar sign expressions, don’t store them as a SET statement since these will be expanded as part of script execution. You could also store functions and/or variables in a script file and simply include the script file in each application as a standard feature.
- Script: Break scripts into several separate tabs and avoid having excessively long sections of code on each tab.
- Screen Size: Establish what screen size should be used as a minimum and set this as your working canvas; the View | Resize Window option can help here.
- Sheet Properties: Always change all sheet properties to prevent users from moving objects around, and apply them to all sheets before you deploy your document to UAT or production.
- Document Properties: On the Security tab, always select Admin Override Security.
Hidden features – Easter eggs
As with many other products, QlikView has a hidden set of features, which are often referred to as Easter eggs.
The Easter eggs in QlikView open up a number of settings that are not available elsewhere; although, you may recognize some that can also be set through the developer interface. There are over 400 settings available, and it is not advisable to change some of them. However, the three that we describe in detail here you may find useful.
How to do it
The Easter eggs are hidden away in the Help menu. Click on About QlikView, and a pop-up window will be displayed, showing you the version and license details. To the lower-left is the Qlik logo:
If you let the mouse hover over the logo and then right-click on it, the Easter egg window appears:
Here, you can make changes to many settings that are not available elsewhere.
The following screenshot shows the AllowMacrosFunctionsInExpressions attribute:
When you create a function with VBScript or JScript in the module editor, the functions are only available to your load script. However, setting the AllowMacroFunctionsInExpressions attribute to 1 allows the functions to be available to all expressions, including charts and graphs.
To do this, first click on AllowMacroFunctionInExpressions in the list, enter 1 in the value box at the bottom of the form, and then click on the Set button.
The following screenshot shows the ApplicationRescue attribute:
Another useful feature is the ability to open corrupt QVW files. Normally, QlikView does not open a file if it appears to be corrupt. However, setting the ApplicationRescue attribute to 1 and then clicking on the Set button will allow QlikView to at least try to recover the document.
This may be something you leave until you have a corrupt document as at least having the error message first will warn you of the issue.
It may not recover the whole document, but in some cases, a little is better than none at all. If you have followed our advice, you should have a couple of previous versions to try before resorting to this option.
The following screenshot shows the ScriptRescue attribute:
As well as the ApplicationRescue option, there is another that needs to be set. The ScriptRescue option needs to be set to 1 if you wish to try to recover the script as well.
Many of the settings available in the Easter eggs list are available via the developer interface, and we recommend that you change these using the appropriate screen options. However, we mentioned three here that we found useful when developing applications. We can’t see why you would not want to have a VBScript or Jscript function available throughout an application. Likewise, on the rare occasion when a document does become corrupt, it’s helpful to have at least some chance of recovering some or all of it.
A few do’s and don’ts
There are some things you should always do, and some you just shouldn’t! You will find many little things in QlikView that you need to lock away in your memory, and they’ll all add to your overall skill level.
Some do’s and don’ts may be thought of as best practice or useful site standards, but here are a few that work better on a personal level.
How to do it
- Use F1: QlikView’s syntax is different from other languages. Use the F1 key to bring up context-sensitive help, showing you the full syntax and parameter list. This helps you learn the syntax and helps ensure that you get the correct results from the start.
- Drop Table: Drop Table in the script is a good way of making things more efficient. Remember, though, that dropping one table with identical fields to another will drop both!
- Drop Fields: If you drop fields, use a list rather than individual statements; it is much more efficient.
- Use the fora: Sometimes, QlikView throws up something odd that does not seem to have a solution and isn’t in the manual. Check out the fora because there’s a good chance that someone else would have had the same problem.
- Read blogs: There are quite a few regular QlikView bloggers, and quite often, there’s a useful gem on a blog that saves hours of frustration in development.
- Read books: It might seem obvious, but reading a few books will fill in the gaps left by the manuals.
- Change Easter egg settings: Never change an Easter egg setting you don’t understand, unless you can restore the environment if everything goes wrong.
- Forget security: Always save a copy of your document and keep it safely before adding security (Section Access). Making a mistake in security can lock you out of your document, and there is no way back!
- Remove All Values: Don’t use File | Reduce Data | Remove All Values if you have list boxes with Always One Selected Value as QlikView will unset the option on the next reload. As an alternative, select a single item (preferably the lowest level available, such as an invoice or a single employee); then, from the Reduce Data menu item, select Keep Possible Values. This will remove all unselected data from your document, leaving just what is selected and hopefully reducing the size of the QVW, while keeping the Always Once Selected Value property intact.
- Give up: At times, QlikView can be infuriating as code may not work the way you think it should. Remember that there are always several ways to do things in QlikView; so, if something doesn’t seem to work, try a different approach!
In this article, we showed you numerous tips and tricks to make you more productive and ensure that you don’t lose your work when things go wrong. Some of these ideas are best practices, while others are simply not documented at all. These are all the things you need to know to help take your skills to the next level.
Resources for Article:
- Analyzing Financial Data in QlikView [article]
- Securing QlikView Documents [article]
- Qlik Sense’s Vision [article]