Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys,
Im trying to run the code below and getting the error :
Syntax error, missing/misplaced FROM:
DataTable:
LOAD IdRecord,
CreateDate,
UpdateDate,
$(varMinDate) AS MinDate,
$(varMaxDate) AS MaxDate
RESIDENT DataTable_temp2
WHERE CreateDate >= $(varMinDate) AND CreateDate < $(MaxDate) AND UpdateDate >= $(varMinDate) AND UpdateDate <
DataTable:
LOAD IdRecord,
CreateDate,
UpdateDate,
$(varMinDate) AS MinDate,
$(varMaxDate) AS MaxDate
RESIDENT DataTable_temp2
WHERE CreateDate >= $(varMinDate) AND CreateDate < $(MaxDate) AND UpdateDate >= $(varMinDate) AND UpdateDate <
I think the load script is not getting the variable values. I debugged it and both LET variable get a value every each iteration.
What could I be doing wrong ? Or how should i be doing what im trying to do ?
the part of my script that is failing:
FOR i = 1 TO NOOFROWS('DateRangeTable')
LET varMinDate = PEEK('MinDate',$(i),'DateRangeTable');
LET varMaxDate = PEEK('MaxDate',$(i),'DateRangeTable');
DataTable:
LOAD IdRecord,
CreateDate,
UpdateDate,
$(varMinDate) AS MinDate,
$(varMaxDate) AS MaxDate
RESIDENT DataTable_temp2
WHERE CreateDate >= $(varMinDate) AND CreateDate < $(MaxDate) AND UpdateDate >= $(varMinDate) AND UpdateDate < $(MaxDate);
NEXT
Thanks.
I just found what the error was.
this line : FOR i = 1 TO NOOFROWS('DateRangeTable')
it had to be : FOR i = 0 TO NOOFROWS('DateRangeTable') -1
Thanks for your help.
Have you checked if your dates are correctly read by QlikView?
Your variable name is varMaxDate while you've used Just MaxDate in your where clause
FOR i = 1 TO NOOFROWS('DateRangeTable')
LET varMinDate = PEEK('MinDate',$(i),'DateRangeTable');
LET varMaxDate = PEEK('MaxDate',$(i),'DateRangeTable');
DataTable:
LOAD IdRecord,
CreateDate,
UpdateDate,
$(varMinDate) AS MinDate,
$(varMaxDate) AS MaxDate
RESIDENT DataTable_temp2
WHERE CreateDate >= $(varMinDate) AND CreateDate < $(varMaxDate) AND UpdateDate >= $(varMinDate) AND UpdateDate < $(varMaxDate);
NEXT
Thanks Vineeth. I made a typo mistake whilst switching the original variables to those that I posted here.Sorry for that. The right script is the one you posted but still getting the same error. I also tried without the WHERE conditions and also got the error.
FOR i = 1 TO NOOFROWS('DateRangeTable')
LET varMinDate = PEEK('MinDate',$(i),'DateRangeTable');
LET varMaxDate = PEEK('MaxDate',$(i),'DateRangeTable');
DataTable:
LOAD IdRecord,
CreateDate,
UpdateDate,
$(varMinDate) AS MinDate,
$(varMaxDate) AS MaxDate
RESIDENT DataTable_temp2;
NEXT
Hi Sunny,
The dates are correctly read by Qlikview. I think the error is coming from the loop but not sure what might exactly be happening because I put my code outside of it and set the peek row position hard coded to 1, and it worked.
LET varMinDate = PEEK('MinDate',1,'DateRangeTable');
LET varMaxDate = PEEK('MaxDate',1,'DateRangeTable');
DataTable:
LOAD IdRecord,
CreateDate,
UpdateDate,
$(varMinDate) AS MinDate,
$(varMaxDate) AS MaxDate
RESIDENT DataTable_temp2
WHERE CreateDate >= $(varMinDate) AND CreateDate < $(varMaxDate) AND UpdateDate >= $(varMinDate) ANDUpdateDate < $(varMaxDate);
Can you post the Screenshot of the Error message ?
I just found what the error was.
this line : FOR i = 1 TO NOOFROWS('DateRangeTable')
it had to be : FOR i = 0 TO NOOFROWS('DateRangeTable') -1
Thanks for your help.
Can you share application with raw data which is similar to your requirement