Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
berryandcherry6
Creator III
Creator III

Getting undefined for variable in load script

Hi,

i have a a variable in Load Script with below

Load

    Min(CanonicalDate) AS MinDate,

    Max(CanonicalDate) AS MaxDate

RESIDENT DateBridge; 

let Month_year  = Date(MonthStart(peek('MaxDate'),-1),'MMM-YY'); 

Now  in frontend

'$(Month_year )' but this gives me Undefined in textbox,


How is to get Jul-16 as answer



Regards,




13 Replies
tamilarasu
Champion
Champion

Hi Supriya,

Try this,

= '$(=Month_year)'

or simply

=Month_year

Anonymous
Not applicable

Remove $ in textbox .just use Month_year

berryandcherry6
Creator III
Creator III
Author

Hi,

No i am not getting any value,its showing blank

sunny_talwar

Can you check if the variable is getting assigned a value in the script by adding a TRACE statement?

LOAD

    Min(CanonicalDate) AS MinDate,

    Max(CanonicalDate) AS MaxDate

RESIDENT DateBridge;

LET Month_year  = Date(MonthStart(peek('MaxDate'),-1),'MMM-YY');

TRACE $(Month_year);

varshavig12
Specialist
Specialist

Also, check this: The Magic of Variables

If nothing works, share your app, someone can then help you.

berryandcherry6
Creator III
Creator III
Author

HI,

Asusual, you always help me out with new ways of debugging. Thanks for Letting me know how to debug in qlik

i am not getting any value it showing blank .

sunny_talwar

So then, your next move should be to just check this:

LOAD

    Min(CanonicalDate) AS MinDate,

    Max(CanonicalDate) AS MaxDate

RESIDENT DateBridge;

LET Month_year  = Date(MonthStart(peek('MaxDate'),-1),'MMM-YY');

LET vTest1 = Peek('MaxDate');

TRACE $(Month_year);

TRACE $(vTest);

berryandcherry6
Creator III
Creator III
Author

No, for that also i am getting blank

sunny_talwar

This has caused a problem for me in the past, can you check this:

TableName:

LOAD

    Min(CanonicalDate) AS MinDate,

    Max(CanonicalDate) AS MaxDate

RESIDENT DateBridge;

LET Month_year  = Date(MonthStart(peek('MaxDate'),-1),'MMM-YY');

LET vTest1 = Peek('MaxDate');

LET vTest2 = Peek('MaxDate', -1, 'TableName');

TRACE $(Month_year);

TRACE $(vTest1);

TRACE $(vTest2);