Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
maniram23
Creator II
Creator II

set and let

what is the difference between set and let?

Labels (1)
4 Replies
morganaaron
Specialist
Specialist

Both assign values to variables in the script - SET assigns the value to the variable without evaluation, as a string, whereas LET first evaluates the expression on the right of the equals sign, then stores it.

There's a good explanation of it here (see the correct answer) by Miguel: Re: $(#variable) when variable is NULL: general script error, why?

rubenmarin
MVP
MVP

Hi mani,

Set: Creates a variable with a defined string or number, ie: SET vPath = ".\AuxDocs";

Let: Defines a variable that can be evaluated, ie: LET vFile = vPath & '\file.txt'; --> vFile will store .\AuxDocs\file.txt

Agis-Kalogiannis
Employee
Employee

A very simple example:

If you create two variables in the script:

SET x = 2 + 3;

and

LET y = 2 + 3;

on the front end,

x will be equal to '2+3' and y will be equal to 5.

ger_alegria
Partner - Creator
Partner - Creator

SET give a value of a String to a variable, i.e:

Set variable = 3*2;

variable = '3*2'

and LET evaluates the expresión on the right of equals sign, i.e:

LET variable = 3*2;

variable = 6

Ger