SET vString = 1 + 1; // The string "1 + 1";
LET vEvalute = 1 + 1; // The value 2
You can get very fancy using variables in Qlikview. You can include arguments inside your variables, so that you can use them like user defined functions.
So, if you wanted to create a 'function' to multiply two numbers you could use a Set like this
SET DOSTUFF = '$1*$2';
The $1 and $2 act as arguments. (Think %1 for a DOS .BAT file)
If you use a SET, it will plug in the arguments and evaluate as a string. i.e.
SET A = $(DOSTUFF(2,2)); // returns '2*2' in A
Note: The dollar sign in front of the DOSTUFF 'function', this signifies Dollar-Sign Expansion, basically some sort of text replacement happens between the parenthesis before it is evaluated.
So, if we instead use a LET
LET A = $(DOSTUFF(2,2)); // returns 4 in A
Showing posts with label Let. Show all posts
Showing posts with label Let. Show all posts
Tuesday, November 29, 2011
Subscribe to:
Posts (Atom)