11 Replies Latest reply: Aug 31, 2016 2:14 AM by Rob Wunderlich RSS

    Master Calendar

    marcin szuberla

      Hi,

       

      Can someone help me with this issue?

      In the attached picture, you can see that not all time tamps in the master calendar have yer, month, etc. associated with them.

      Also, although I load DISTINCT, I see duplicates (row 3 and 4).

       

      My calendar script is here:

      Master_Calendar_Link_Table:

      Load Distinct

      ID as key_Calendar,
      Timestamp(round("Scan_Completed_DT", (1/24))) as Date

      Resident DATATABLE;

       

       

      MinMaxDates: 
      LOAD Floor(Min(TimeStamp(Date, 'MM/DD/YYYY hh:mm'))) AS MinDate,  
      Floor(Max(TimeStamp(Date, 'MM/DD/YYYY hh:mm'))) AS MaxDate 
      RESIDENT Master_Calendar_Link_Table; 

      LET vMinDate = FieldValue('MinDate', 1); 
      LET vMaxDate = FieldValue('MaxDate', 1);  

      DROP TABLE MinMaxDates;   

       

       

      CalendarTemp: 
      LOAD
           TimeStamp($(vMinDate) + (RecNo()/24) + (IterNo() - 1)) AS AddedTimeStamp
      AUTOGENERATE 24 WHILE Num($(vMinDate) + IterNo() -1) <= Num($(vMaxDate)); 

       

      MasterCalendar:
      LOAD
      AddedTimeStamp AS Date,  
      Year(AddedTimeStamp) AS Year,
      month(AddedTimeStamp) AS Month,
      day(AddedTimeStamp) AS Day,
      hour(AddedTimeStamp) AS Hour,
      weekday(AddedTimeStamp) AS Weekday
      Resident CalendarTemp;

      Drop table CalendarTemp;