Back end

Sublime for Qlik development in 9 steps

When developing QlikView and Qlik Sense scripts I prefer to use Sublime for scripting over the built in script editors. I have found separating script and layout to be a good idea partly because it enables me to run scripts in both QlikView and in Qlik Sense, partly because it is easier to handle when using version control such as GIT and partly because it makes it easier to separate the script and the layout development between individuals.

Sublime is an excellent text editor tool that have a lot of possiblilties in regards of tweaking and customizing. To get it as Qlik effective as possible for my needs I usually customize it a bit. In this blogpost I will describe to you how I set up Sublime when I enter a new development environment.

1. Sublime

Get your own copy of Sublime 3 and install it on your computer. It is available as a normal installation and as a portable version, my adjustments further down this post will work on both instances. I tend to choose the normal installation wherever I am allowed to do normal installations and use the portable version where I am not.

Sublime 3 editor

Sublime is free to try, but if you continue using it you are obliged to phurchase a license. The licensing model is one license per user and not per machine. This licensing model is benificial for me as a multi site developer, I only need my single license to work on all my clients Qlik environments.

2. Package Control

Package Control is a Sublime extension manager that makes it easy to do installations, updates and removal of a wide range collection of extensions.

Package Control Stats

I always start of my Sublime custimisation  by installing this extension. I keep it simple by installing by using the Simple method, opening the Sublime console and paste the block of text described in the Package Control Installation page.

Show Console
Console

3. InQlik Tools

InQlik is a fantastic plugin for Sublime if you developing QlikView or Qlik Sense. It contains a set of tools  for QlikView development but it also highly compatible with Qlik Sense scripting. InQlik Tools was the deal breaker for me, it’s what made me switch from notepad++ and QlikView desktop client scripting.

Highlighting

InQlik provides Qlik script highlighting and type ahead. It does also support syntax highlighting for QlikView log files that really helps when examining QlikView log-files.

Below is an example on how a piece of qvs script will change with the syntax highlighting.

Comparison with and without highlighting activated

QVD meta data

Another great featur is the QVD meta data viewer that generate a plain test metadata presentation when you click on a QVD file. It provides the followin information

  • QVD creation time
  • Field names in the QVD
  • Number of unique values per  field
  • Memory usage per field

It also generate a sample load statement that you can copy and paste into your script.

Example (Customers.qvd):

Customers.MD
---

91 records. QVD created at 2016-08-12 09:32:45

###Fields:

- **CustomerID**. Unique values: 91, Memory usage: 637
- **CompanyName**. Unique values: 91, Memory usage: 1925
- **ContactName**. Unique values: 91, Memory usage: 1463
- **ContactTitle**. Unique values: 12, Memory usage: 237
- **City**. Unique values: 69, Memory usage: 689
- **PostalCode**. Unique values: 85, Memory usage: 893
- **Country**. Unique values: 21, Memory usage: 178


####Sample load statement:

```QlikView

LOAD
 CustomerID,
 CompanyName,
 ContactName,
 ContactTitle,
 City,
 PostalCode,
 Country,
 FROM [C:\Qlik\Exercises\1.Example\2.QVD\Customers.qvd] (QVD);

```

I do also use EasyQlik QViewer as a qvd-tool, but I find InQlik Tools much faster for just this tas, especially when I already have Sublime up and running with a mounted folder  with qvds in my sidebar.

Variable handling

InQlik Variable Tool

Thirdly the plugin includes an YAML like language plugin for generating variables. The output is plain Qlik script-code the csv format used by the Qlik Deployment Framework (QDF).

InQlik Variable Tool InQlik Variable Tool

You can read more about the InQlik tool plugin at GitHub – inqlik/inqlik-tools.

InQlik Tools is available through the Package Control. If Package Control is installed then just type Ctrl-Shift-P and then start typing Install package untill you see the Package Control: Install Package in your drop down menu.
Package control install
Package control install inqlik_tools

Press enter when InQlik-Tools occur and the Package Control handles the installation for you.

4. Advanced CSV

I often run into csv-files in my Qlik development. I tend to choose csv-over over Excel when create supporting tables manually. CSV is plain text and it is not necessary to install Excel or other compatible software to edit when working on a Qlik server maschine.

I found Advanced CSV to be quite useful for handling my csv-files. I motstly use it for the ability to justify columns, but it also offer the possibility to select/add/remove columns which is hard todo in an text editor without this extension.

5.  Sidebar enhancements

An other useful plugin is the Sidebar Enhancements. It enhances your  sidebar with easy access to often used tasks such as move, copy, rename, run, refresh etc.

You can use package control to install the Sidebar enhancement plugin. Follow the steps you used when installing InQlik Tools in the section above.

6. Comment script shortcut

The default sublime comment shortcut is Ctrl-/ and Ctrl-Shift-/. In QlikView and Qlik Sense I am used to Ctrl-K combinations for commenting and un-commenting script. Therefore I use to change the default key bindings in Sublime into Qlik Sense syntax, Ctrl-K and _Ctrl-Shift-K. Ctrl-K is used as a base for multiple shortcuts in Sublime, because of that I’ve started to define my shortcut as “Alt-K” and “Alt-Shift-K”.  You will find the setup for key bindings in the preferences pane. See picture below.

Sublime Key Bindings

To change my key binding I  type the following into my key binding user config file.

[
 { "keys": ["alt+k"], "command": "toggle_comment", "args": { "block": false } },
 { "keys": ["alt+shift+k"], "command": "toggle_comment", "args": { "block": true } },
]

7. Dark text on light background

I prefer dark text on light canvas when working in daylight. The built in LAZY, Eiffel and iPlastic are good alternatives to the black default theme. Give them a try, you will find then under the Preferences menu.

Comparison of light themes i Sublime Text 3

8. Markdown

If you are used to write documentation using markdown syntax, then the Markdown Preview and MarkdownEditing are good final tweaks to your Sublime. It also possible to use these plugin to prettify your QVD meta data output hence that is written with markdown syntax. It is available through Package control.

9. Show encoding

If you use special characters, like ä, ü, é and æ,  in your qvs scripts then the file encoding becomes an issue. I usally do this little tweak in my preferences file. It adds a little indication in the bottom right corner of which encoding my open file is using.

 

Preferences->Settings

{
  "show_encoding": true
}

Final words

This setup works for me for traditional QlikView and Qlik Sense scripting. I have not included any tweaks or adjustments to meet demands for developing against the the Qlik API capabilities. If you are working with a sublime setup for this please share. Write your own blogpost or type something shorter in the comment section below.  You are also welcome to comment if you have comments, other tips tweaks or plugins that helps in your Qlik Sense or QlikView development.

 

 

3 comments on “Sublime for Qlik development in 9 steps

  1. I love Qlik development with Sublime Text! I was not aware of Advanced CSV and I will check it out. I moved as much code as possible out of QVW files and into QVS script just so I could use Git and Sublime Text 3.

    One thing that I found very useful but not in your article is the //#! which enables you to use the F7 to run a QlikView Reload.

    1. Yes, I use the //#! as well, but make sure to use relative paths, not absolute. This allows the F7 to work in different QDF-environments without modification to the script.

Leave a Reply

Your email address will not be published. Required fields are marked *