Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello all!
This is my first post to Qlik Community.
I need to create a variable with a spesific set expression each month. To my understanding this requires generating the variable name with a function as well as defining period to a set expression with a function. The problem seems to be that I cannot have funtions on either side of the LET expression. I tried to work around this with no success.
Any ideas why this might be occurring?
BR,
Erno
LET v_cur_period=year(today()) & date(today(),'MM');
// The above script gives: 201407
//I can have :
LET "v_COP_reg_vnum_YTD_$(v_cur_period)" = 1;
//OR
LET v_COP_reg_vnum_YTD_201407 = 'sum({$<[Data Snapshot Date] = {'&$(v_cur_period)&'}>}[FP1 Stat.Reg. Price])';
//But not the following:
LET "v_COP_reg_vnum_YTD_$(v_cur_period)" = 'sum({$<[Data Snapshot Date] = {'&$(v_cur_period)&'}>}[FP1 Stat.Reg. Price])';
//I tried to work around this with no effect:
LET v_COP_reg_vnum_YTD_cur_temp = 'v_COP_reg_vnum_YTD_'&$(v_cur_period);
LET $(v_COP_reg_vnum_YTD_cur_temp) = 'sum({$<[Data Snapshot Date] = {'&$(v_cur_period)&'}>}[FP1 Stat.Reg. Price])';
Got it. Actually there was nothing wrong in this particular part of the script. The script that uses this part later was faulty and the error message was confusing.
this expression can be written with
LET v_COP_reg_vnum_YTD_cur_temp = 'v_COP_reg_vnum_YTD_'&$(v_cur_period);
SET ......
I cannot understand This other
LET $(v_COP_reg_vnum_YTD_cur_temp) = 'sum({$<[Data Snapshot Date] = {'&$(v_cur_period)&'}>}[FP1 Stat.Reg. Price])';
Actually now when I think of my workaround it does exactly same thing as my actual problem - using variable including function as a name so nevermind that. 😕
SET might be better but doesn't affect the problem.
Got it. Actually there was nothing wrong in this particular part of the script. The script that uses this part later was faulty and the error message was confusing.