Qlikview Variables

Find this post interesting? Do you like interesting things? Maybe you would like my invention, a connectible candle called a WickBrick!

Get one here http://wickbrick.etsy.com/


SET versus LET

SET Var1 = 2 * 3

Takes what ever is on the right and places it in the variable as literal text. So Var1 will = 2 * 3

If you use the LET (LET Var2 = 2 * 3)

It will evaluate and place the result into the variable. Var2 will = 6

How does QlikView handle these variables?

In the UI you can refer to a variable in two ways either by Var1 which will return 2 space asterisk space three.

If you refer to it using $(Var1) (wrapping in dollar sign open param close param) this is read as the evaluation of Var1 which will evaluate it at run time.

Var2 has already been evaluated so if you refer to it as Var2 or $(Var2) it still is going return a = 6

So the big difference between LET and SET is that the LET will be evaluated during the script, if you use the SET you can have have the variable evaluated during the UI.

One crazy way of using a variable is if in your load script if you had (the doc being named ChangeTable.qvw)

An ODBC connect string and then

SELECT * FROM $(MyTable);

Then you can reload from the command line

c:\Program Files\QlikView\qv.exe ChangeTable.qvw /l /vMyTable=Products

The /l means reload it and keep it open, and the /v means pass a variable to the QlikView

Another way of using Variables, is that you can have Expressions stored in either a xls document or a database.


One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s