Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Error in calendar

Hello, can someone please give me an advice?

In data load I have this error:

The following error occurred:

Autogenerate: generate count is negative

The error occurred here:

TempCal: Load DATE(+RowNo()-1)as TempDate AutoGenerate -+1

I know, that reason this error is in this order, that I made for making right date:

  Date(Floor(Filebasename()))as Edate,

  FileBaseName()

I take data from autogenerated files, that have name example: ZLX02S_20171201_055500.txt

Anyone have an idea how it repair?

I have inside files a field, that have date, but its not right date for me and to get right results I cant use it. But when I use it like my base date, my calendar work.

3 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

It looks like you are using variables which have not been assigned, or have a null value. This is probably because your file name contains a date and your Date() function is not taking the file name structure into account, so Edate is always null.

I think your load should be (based on the filename you mentioned in your post)

     Date#(Substring(Filebasename(), '_', 2), 'yyyyMMdd') as Edate,

I suggest you post the complete script that you are using to generate the calendar.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Anonymous
Not applicable
Author

Thank you for response. But it dont work, your script is wrong. In code word "Substring" system take as field. Did you mean Substringcount? But after use Substringcount I have in red   "," and everything after "," is in red like error.

Here is my wholle calendar:

MinMax:

Load

Min(Edate) as MinDate,

Max(Edate) as MaxDate

Resident [Data];

Let vMinDate = Num(Peek('MinDate',0,'MinMax'));

Let vMaxDate = Num(Peek('MaxDate',0,'MinMax'));

TempCal:

Load

DATE($(vMinDate)+RowNo()-1)as TempDate

AutoGenerate

$(vMaxDate)-$(vMinDate)+1;

DROP TABLE MinMax;

"Master Calendar":

Load

    TempDate as Edate,

    Year(TempDate) as Year,

    Month(TempDate) as Month,

    Week(TempDate) as Week,

    Day (TempDate) as Day,

   'Q'& Ceil(Month(TempDate)/3) as Quarter,

   Date (MonthStart (TempDate),'YYYY-MM') as "Year-Month",

   Date (WeekStart (TempDate)) as "Year-Week"

 

  

   Resident TempCal

Order by TempDate ASC;

Drop Table TempCal;

Anonymous
Not applicable
Author

It was easy to repair, when I rocognized, what is wrong. I only corrected Filebasename and changed it for Filetime. Nothing more and now it is working. 🙂