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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Script Error

Hi,

Can someone point me in the right direction. I am getting the below script error when loading. Data source is a csv file converted into QVD

Script line error:

TempCal:

LOAD

Date( + rowno() -1) as TempDate

AutoGenerate  -  + 1

I have a suspicion it is to do with date format but can't solve the issue. I am getting another error after the first

Table not found

MasterCalendar:

LOAD

Code is below

MinMax:
LOAD
Min([Contact Date]) as MinDate,
Max([Contact Date]) as MaxDate
RESIDENT Contacts;

LET vMinDate = Num(Peek('MinDate',0,'MinMax'));
LET vMaxDate = Num(Peek('MaxDate',0,'MinMax'));
LET vToday = today();
LET vCurrentMonth = Month(Today());
LET vNextMonth = Month(AddMonths(Date(Today()),1));
LET vCurrentYear = Year(Today());
//LET vCurrentYear = Year($(vMaxDate));

DROP TABLE MinMax;
//Create Temporary Calendar
TempCal:
LOAD
Date($(vMinDate) + rowno() -1) as TempDate
AutoGenerate $(vMaxDate) - $(vMinDate) + 1;
//Create Master Calendar

8 Replies
m_woolf
Master II
Master II

Have you stepped through the load? What are the values for vMinDate and vMaxDate?

I would remove the date() function from $(vMinDate) in the TempCal load.

jonathandienst
Partner - Champion III
Partner - Champion III

TempCal:

LOAD

Date( + rowno() -1) as TempDate

AutoGenerate  -  + 1

The autogenerate parameter is garbled because for some reason the variables are undefined. Its possible that the Contacts table is empty so there is no MinDate or MaxDate for your Peek()s. Single step through your code in the debugger and check the variables. But I suspect a problem with Contacts.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Kushal_Chawda

what is the value in variable vMinDate & vMaxDate . I think values are not populating in the variable.

Check the format of Contact date, I think it is text.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

While I do agree with Jonathan in that the most probable cause would be non-existent variables, there is a small chance that the MinMax table simply doesn't exist (because of unwanted autoconcatenation). Peek will never report an error when the specified table could not be found. It will simply return NULL, thereby undefining the variables.

If Contacts proves to be all right, check whether MinMax is created as expected...

Peter

jagan
Partner - Champion III
Partner - Champion III

Hi,

Check below link

Master Calendar Generation Script

Regards,

Jagan.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Good thinking!

Does it work if you add these:

LET vMinDate = Num(Date#(Peek('MinDate',0,'MinMax')));
LET vMaxDate = Num(Date#(Peek('MaxDate',0,'MinMax')));

maxgro
MVP
MVP

I tried adding this to simulate Contacts before your script

Contacts:

load (makedate(2015)+rowno()-1) as [Contact Date]

AutoGenerate 365;

and it works; I think the problem is the field [Contact Date], maybe not a date

example with this

Contacts:

load 'text' as [Contact Date]

AutoGenerate 365;


I get your error

Script line error:

TempCal:

LOAD

Date( + rowno() -1) as TempDate

AutoGenerate  -  + 1


Not applicable
Author

Hi, Thanks for all your responses. You have allowed me to fix the issue which turned out to be the date field Date format 'DD MMM YY' and I was using 'DD MMM YYYY'. Thanks for your help all