2 Replies Latest reply: Dec 6, 2017 7:12 AM by Daniel Kuba RSS

    Error in calendar

    Daniel Kuba

      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.

        • Re: Error in calendar
          Jonathan Dienst

          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.

            • Re: Error in calendar
              Daniel Kuba

              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;