Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

kushalthakral
Contributor II

Can LET can be used as SET in qlikview script

Dear All

is there anyway we can use LET function as SET function in script

Regards

Kushal Thakral

6 Replies

Re: Can LET can be used as SET in qlikview script

I think you want something like this:

set eLoadStart = "num(now() - today(), '#.########', '.', ',')";

let vLoadStart = $(eLoadStart);

- Marcus

bwisenosimenkg
Valued Contributor

Re: Can LET can be used as SET in qlikview script

For the most part, Yes.

You can write:
let vTest = 'sum(Amount)';

or

set vTest = sum(Amount);

they are both evaluated when your write $(vTest) in your application.

I'm more unsure of the syntax:

Set vTest = =sum(Amount)

As far as i know, writing:
Let vTest = '=sum(Amount)';

will not give the same results.

Not applicable

Re: Can LET can be used as SET in qlikview script

What are you trying to achieve and why would you want to do this?

The simple answer to this would be no.

The LET statement evaluates the expression on the right side of the '=' before it is assigned to the variable, the SET will assign the text on the right hand side of the '='.

SET V1 = 1+2;  Returns 1+2

SET V2 = 1+3;   Returns 3

kushalthakral
Contributor II

Re: Can LET can be used as SET in qlikview script

hi all

actually

i have created two variables using set and let

set vtest='today()';

let vtest1=today();

in the variable overview screen  i am getting today() and 02/12/2014

but i actually want same output in both means 02/12/2014

Re: Can LET can be used as SET in qlikview script

Hi,

LET and SET are different when you define any value in the SET it treat as string and what ever we write it is string. But if ay assigning in the LET its value calculate and assign to the variable.

Ex:-

SET vNowSet = 'NOW()'; //This gives NOW()

LET vNowLet = $(vNowSet); //This gives Current date and time value

Regards

Anand

kushalthakral
Contributor II

Re: Can LET can be used as SET in qlikview script

Hi Anand

Thanks for your input but somebody ask this question to me in an interview that how can we use let functionality in set functions

Regards

Kushal Thakral

Community Browser