3 Replies Latest reply: Jan 6, 2011 2:09 AM by DANIEL CHOTZEN RSS

    General Script Error

      I am trying to look up a calender file returning a single record with Today's date. Using this returned record I am trying to get the Financial Year & Period value and then in another table return all records from the same calendar table so I can then get the start date of the Financial Year & Period combination.

      My issue is that each time I run it I get the General Script error message. Can anyone please provide me with information on what I am doing wrong.


      SET dteToday= date(ReloadTime());

      Calendar:
      LOAD FinancialYear,
      FinanceYearPeriod,
      Date,
      CalendarWeek,
      FinancialPeriod,
      FinancialPeriodWeek,
      FinancialWeek,
      FinancialQuarter,
      Day,
      FullDate,
      CalenderDocCounter,
      NoOfDaysInPeriod,
      NoOfDaysInYear
      FROM
      \\206.156.1.3\QlikView\Data_QVD\Calendar.qvd (qvd)
      WHERE FullDate = $(dteToday);

      SET v1 = min(FinanceYearPeriod);

      //get todays period details
      TodayDetails:
      LOAD Date as NODDate,
      FullDate as nodFull,
      1 as DayCounter,
      FinanceYearPeriod
      Resident Calendar Where FinanceYearPeriod = $(v1);

      set vThisFYP = load min(FinanceYearPeriod) resident Calendar;
      Set vThisPeriodStart = min(nodFull);

       

       

      Many Thanks

        • General Script Error
          MManders

          So with "each time I run it" you mean a reload?

          If so, then the first variable is set to now and I am not sure table Calendar will have a record with field FullDate =now ...?!?

          But perhaps you meant something else?

          • General Script Error
            Rakesh Mehta

            Try:

             


            Calendar:
            LOAD FinancialYear,
            FinanceYearPeriod,
            Date,
            CalendarWeek,
            FinancialPeriod,
            FinancialPeriodWeek,
            FinancialWeek,
            FinancialQuarter,
            Day,
            FullDate,
            CalenderDocCounter,
            NoOfDaysInPeriod,
            NoOfDaysInYear
            FROM
            \\206.156.1.3\QlikView\Data_QVD\Calendar.qvd (qvd)
            WHERE FullDate = $(dteToday);
            MinFY:
            LOAD min(FinanceYearPeriod) as MinFY
            RESIDENT Calendar
            GROUP BY 1;
            Let v1 = peek('MinFY');
            DROP TABLE MinFY;
            //get todays period details
            TodayDetails:
            LOAD Date as NODDate,
            FullDate as nodFull,
            1 as DayCounter,
            FinanceYearPeriod
            Resident Calendar Where FinanceYearPeriod = $(v1);


            The min() and max() functions require GROUP BY addition. The code above should run fine, or atleast give you idea.