Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
When creating the script or an expression in QlikView, you need to reference fields, explicit values and variables. To do this correctly, you sometimes need to write the string inside a pair of quotation marks. One common case is when a field name contains a symbol that prevents QlikView from parsing it correctly, like a space or a minus sign.
For example, if you have a field called “Unit Cost”, then
Load Unit Cost
will cause a syntax error since QlikView expects an "as" or a comma after the word "Unit".
If you instead write
Load [Unit Cost]
QlikView will load the field “Unit Cost”. Finally, if you write
Load 'Unit Cost'
QlikView will load the text string "Unit Cost" as field value. Hence, it is important that you choose the correct quotation mark.
So, what are the rules? Which quote should I use? Single? Double? Square brackets?
There are three basic rules:
With these three rules, most cases are covered. However, they don’t cover everything, so I'll continue:
A general rule in QlikView is that field references inside a Load must refer to the fields in the input table – the source of the Load statement. They are source field references or in-context field references. Aliases and fields that are created in the Load cannot be referred since they do not exist in the source. There are however a couple of exceptions: the functions Peek() and Exists(). The first parameters of these functions refer to fields that either have already been created or are in the output of the Load. These are out-of-context field references.
I have deliberately chosen not to say anything about SELECT statements. The reason is that the rules depend on which database and which ODBC/OLEDB you have. But usually, rules 1-3 apply there also.
With this, I hope that the QlikView quoteology is a little clearer.
Further reading related to this topic:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.