Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Everyone,
I have in my folder below standing files, which are stored with year_month time stamp :
Orders_2020_01.qvd
.....
Orders_2020_09.qvd
I need to load dynamically last 30 days.
I was trying this script, but have this error:
Unexpected token: '_01', expected one of: 'OPERATOR_PLUS', 'OPERATOR_MINUS', 'OPERATOR_MULTIPLICATION', 'OPERATOR_DIVISION', 'OPERATOR_STRING_CONCAT', 'like', 'and', ...
IF 2010>>>>>>_01<<<<<< >= 2020_08 THEN
SCRIPT:
LET vDateLimitMax = DATE(today(),'YYYY_MM') ;
LET vDateLimitMin = DATE(today()-30,'YYYY_MM');
SET FileDate = '';
trace loop start;
trace;
for each File in filelist ('lib://MY_PATH/*.qvd')
SET sFile = '$(File)';
LET FileDate = left(right(sFile,11),7);
trace *** processing $(File) dated $(FileDate);
IF $(FileDate) >= $(vDateLimitMin) THEN
Directory;
TABLE:
LOAD * FROM [$(sFile)](txt, codepage is 28591, no labels, delimiter is '\t', msq);
trace file loaded;
trace;
ELSE
trace file ignored;
trace;
ENDIF
next File
trace loop end;
This solution I found here
Thanks for help!
Hey Community,
any idea?
Looks like the error is because your file name is not exactly matching with the thread you are taking reference. See the screenshot of that thread below.
Thank you replay!
This link is just a solution which i found and I was trying to use in my case.
MY problem occurs here:
Unexpected token: '_01', expected one of: 'OPERATOR_PLUS', 'OPERATOR_MINUS', 'OPERATOR_MULTIPLICATION', 'OPERATOR_DIVISION', 'OPERATOR_STRING_CONCAT', 'like', 'and', ...
IF 2010>>>>>>_01<<<<<< >= 2020_08 THEN
You need to convert the time format from a string to a value ($(FileDate)) to compare in an if condition. Now it takes your value in the condition as a string and it can't be compared.