Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
digichap28
Creator
Creator

Error: Syntax error, missing/misplaced FROM:

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.

1 Solution

Accepted Solutions
digichap28
Creator
Creator
Author

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.

View solution in original post

7 Replies
sunny_talwar

Have you checked if your dates are correctly read by QlikView?

Get the Dates Right

Why don’t my dates work?

vinieme12
Champion III
Champion III

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

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
digichap28
Creator
Creator
Author

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

digichap28
Creator
Creator
Author

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);

vinieme12
Champion III
Champion III

Can you post the Screenshot of the Error message ?

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
digichap28
Creator
Creator
Author

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.

Anil_Babu_Samineni

Can you share application with raw data which is similar to your requirement

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful