Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

let and set difference

hi friends

what is the meaning of let and set in the qlikview??

and point out the differences in them in detail?

1 Solution

Accepted Solutions
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Let: Calculates the expression assigned to it and sets the expression result to the variable.

     Set: Assigns the value(or expression which is after the equal sign) as it is without compute.

Example:

     Set vVar=2+3; //vVar has the expression 2+3 as value we have to compute it using $(vVar) which returns 5

     Let vVar=2+3;//vVar has the computed value 5

Hope it helps

Celambarasan

View solution in original post

8 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Let: Calculates the expression assigned to it and sets the expression result to the variable.

     Set: Assigns the value(or expression which is after the equal sign) as it is without compute.

Example:

     Set vVar=2+3; //vVar has the expression 2+3 as value we have to compute it using $(vVar) which returns 5

     Let vVar=2+3;//vVar has the computed value 5

Hope it helps

Celambarasan

Not applicable
Author

Hello,

there is a pretty good explanation in the Qlikview Help:

The let statement has been created as a complement to the set statement, used for defining script variables. The let statement, in opposition to the set statement, evaluates the expression on the right side of the ' =' before it is assigned to the variable.

The word let may be omitted, but the statement then becomes a control statement. Such a statement without the keyword let must be contained within a single script row and may be terminated either with a semicolon or end-of-line.

Examples:

Set x=3+4;

Let y=3+4

z=$(y)+1;

$(x) will be evaluated as ' 3+4 '

$(y) will be evaluated as ' 7 '

$(z) will be evaluated as ' 8 '

jagan
Luminary Alumni
Luminary Alumni

Hi,

SET just assigns the value as string whatever you give.

LET evaluates the expresion and assigns it to the variable.

LET vString = 'Qlik' & 'View'  (Now vString has QlikView)

LET vNumber = 2 + 3 (Now vNumber has5)

Hope this helps you

Regards,

Jagan.

Not applicable
Author

thnx

Not applicable
Author

k thanks but what happen when i write

let a=b+7?

can any one say it...

thanks

Praveen

Not applicable
Author

thanx

Anonymous
Not applicable
Author

Set x=3+4;

Let y=$(y)*3

z=$(y)


So my question is


z will be  3+4*3 = 15  or  (3+4) *3 = 21

stevewithington
Contributor
Contributor

I realize this post is a bit dated, however there was a really good post in the Qlik Design Blog addressing this very question in great detail which I personally found quite helpful: The Magic of Variables

Cheers!