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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Variable Evaluation Problem

Hi guys,

I have declared a variable which does a data conversion. I want to add this variable so that it loads the correct file which has this date appendage at the end, while in a loop.


set


PrevDateYYMM= right(date(addMonths(MAKEDATE(20&LEFT([Master_Calendar_Month_Key],2),RIGHT([Master_Calendar_Month_Key],2)), -1)), 2) & mid(date(addMonths(MAKEDATE(20&LEFT([Master_Calendar_Month_Key],2),RIGHT([Master_Calendar_Month_Key],2)), -1)), 4, 2);

LOAD

'$(PrevDateYYMM)'

TEAM

FROM [REPORT_$(PrevDateYYMM)];





The problem is with this is that it does not evaluate the variable. If I create a field in the script with the same code I get the correct figures but I have to compute this in the script to load the correct files as I am also doing a loop. What it is not doing is giving an error saying cannot load REPORT_$right(date(addMonths(MAKEDATE(20&LEFT([Master_Calendar_Month.......(full expression).

I've tried using both let and set but neither are giving me the answer i want. Has anyone any ideas as the method to create the value is correct, it just uses the expression and not the computed value in the script.

Thanks,

2 Replies
vgutkovsky
Master II
Master II

Put the word LET in front of the variable declaration instead of SET 🙂

Regards,

Not applicable
Author

Thanks Vlad,

Had used LET previously - just realised the problem I had was i was referencing the wrong field when doing so, d'oh! 🙂

Thanks again