Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I was trying to create a variable using peek() function in Qlik sense Script editor. But no value was assigned to the variable. Can someone please help me here?
MaxYear:
LOAD MaxFY
FROM
[lib://Documents/MaxFY.qvd]
(qvd);
let vMaxYear= peek('MaxFY');
let vLastYear=$(vMaxYear)-1;
Thanks
Hi,
Seems you are getting the max value, why can't you use Max() in load script like below
MaxYear:
LOAD Max(MaxFY) AS MaxFY
FROM
[lib://Documents/MaxFY.qvd]
(qvd);
let vMaxYear= peek('MaxFY');
let vLastYear=$(vMaxYear)-1;
Peek() always gives you the last value read, if the last value is null then you won't get any value in Peek().
Hope this helps you.
Regards,
jagan.
Does a table named MaxYear exist after the script is executed and does the last row of that table contain a value in the field MaxFY?
Hi Gysbert,
Thanks for your quick response. Yes, MaxYear table is existed after script execution and also MaxFY has the value.
Thanks
Does the variable vMaxYear have a value? Can you post the MAXFY.qvd file?
Hi, Sat,
let vMaxYear= peek('MaxFY',-1,'MaxYear');
Hi,
Seems you are getting the max value, why can't you use Max() in load script like below
MaxYear:
LOAD Max(MaxFY) AS MaxFY
FROM
[lib://Documents/MaxFY.qvd]
(qvd);
let vMaxYear= peek('MaxFY');
let vLastYear=$(vMaxYear)-1;
Peek() always gives you the last value read, if the last value is null then you won't get any value in Peek().
Hope this helps you.
Regards,
jagan.