Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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.
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.
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.
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
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')));
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
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