Qlik Script Syntax Highlighting - An Ometis Guide - Ometis Blog
Qlik

Qlik Script Syntax Highlighting – An Ometis Guide

Posted on: 29th May 2019, 9:30 am

Qlik script syntax highlighting is an efficient and useful way for developers to keep track of their script.

Qlik Sense script uses a syntax colour highlighter to identify script keywords. This is very useful for developers to distinguish a field name from a variable name, for example. Effectively, it provides the developer  with live feedback of how Qlik reads the script. Allowing developers to spot errors before performing a reload.

Qlik Script Syntax Highlighting

Below is a key to understand the syntax highlighter:

ColourDefinitionDescriptionExamples
Blue
#6A8FDE
RGB(106, 143, 222)
Statements / KeywordsIn Qlik Sense script, a number of script statements can be utilised. A statement can also be referred to as a keyword. All script keywords can be typed with any combination of lower and upper case characters.LOAD
SQL
LET
SET
QUALIFY
Caramel
#CC9966
RGB(204, 153, 102)
Field nameWithin a LOAD statement, Qlik will represent field names in this colour. Spaces must be escaped with parenthesis.Field_Name
“Field name”
[Field Name]
Purple
#8e477d
RGB(142, 71, 125)
Table nameIn Qlik script you can specify a table name prior to a LOAD statement. Spaces must be escaped with parenthesis.Table_name
“Table name”
[Table name]
Pink
#CC99CC
RGB(204, 153, 204)
Variable You can create a variable using the SET and LET control statements. A variable is defined by a single word.
It is not recommended to name a variable identically to a field or a function in Qlik Sense.
vVariableName
varVariableName
VariableName
variableName
Green
#44751d
RGB(68, 117, 29)
String literalString literals are commonly used for defining a variable value or assigning a static value within a Load script. String literals are wrapped in single quotes ( ‘ ).‘DD/MM/YYYY’
‘£#,##0.00;-£#,##0.00’
‘Mon;Tue;Wed;Thu;Fri;Sat;Sun’
Black
#595959
RGB(89, 89, 89)
Normal textNormal text can be seen after the SQL keyword, as Qlik does not offer highlighting for third-party languages. Other examples include after the TRACE statement.This is what normal text, within the script, looks like.
Red
#ff0000
RGB(255,0,0)
ErrorShown immediately at the position of an error detected in the script.This is what an error looks like in the script.
Black with a Red shadow
#595959 #f05555

RGB(89, 89, 89) RGB(240, 85, 85)
Post-errorAll script following an error will change to this colour until the script has been corrected and valid.This is what a post-error script looks like.
Grey
#808080
RGB(128, 128, 128)
CommentIt is best practice to comment your script. Comments are shown in grey. There are three methods of commenting; ‘//’, ‘/**/’, REM.This is what text that has been commented out looks like.

As always, you can stay up-to-date on the latest Qlik news by following Ometis on Twitter, LinkedIn and YouTube. We’re always keen to hear feedback as well, so please let us know your thoughts on any of the above in the comments below.

By Chris Lofthouse

Comments

Leave a Reply

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

Get the most from Qlik Sense

Our range of Qlik Sense add-ons will enable you to get the most out of your platform.