0 Replies Latest reply: Apr 21, 2017 11:17 AM by Salamon Musayev RSS

    Store AutoCalendar into QVD

    Salamon Musayev

      Hello,

       

      I have noticed that when we add table into Qlik through the data manager, it automatically creates an auto calendar that basically function like a master calendar.  It has an added benefit that its 1 script for all date fields. 

       

      However when I store that table in QVD, the autocalendar does not come through.

      Also when trying to store the autocalendar as a separate QVD, it also fails and displays a message that the table does not exist.

       

      Below is auto-generated script of the autocalendar:

       

      [autoCalendar]:

        DECLARE FIELD DEFINITION Tagged ('$date')

      FIELDS

        Dual(Year($1), YearStart($1)) AS [Year] Tagged ('$axis', '$year'),

        Dual('Q'&Num(Ceil(Num(Month($1))/3)),Num(Ceil(NUM(Month($1))/3),00)) AS [Quarter] Tagged ('$quarter', '$cyclic'),

        Dual(Year($1)&'-Q'&Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [YearQuarter] Tagged ('$yearquarter', '$qualified'),

        Dual('Q'&Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [_YearQuarter] Tagged ('$yearquarter', '$hidden', '$simplified'),

        Month($1) AS [Month] Tagged ('$month', '$cyclic'),

        Dual(Year($1)&'-'&Month($1), monthstart($1)) AS [YearMonth] Tagged ('$axis', '$yearmonth', '$qualified'),

        Dual(Month($1), monthstart($1)) AS [_YearMonth] Tagged ('$axis', '$yearmonth', '$simplified', '$hidden'),

        Dual('W'&Num(Week($1),00), Num(Week($1),00)) AS [Week] Tagged ('$weeknumber', '$cyclic'),

        Date(Floor($1)) AS [Date] Tagged ('$axis', '$date', '$qualified'),

        Date(Floor($1), 'D') AS [_Date] Tagged ('$axis', '$date', '$hidden', '$simplified'),

        If (DayNumberOfYear($1) <= DayNumberOfYear(Today()), 1, 0) AS [InYTD] ,

        Year(Today())-Year($1) AS [YearsAgo] ,

        If (DayNumberOfQuarter($1) <= DayNumberOfQuarter(Today()),1,0) AS [InQTD] ,

        4*Year(Today())+Ceil(Month(Today())/3)-4*Year($1)-Ceil(Month($1)/3) AS [QuartersAgo] ,

        Ceil(Month(Today())/3)-Ceil(Month($1)/3) AS [QuarterRelNo] ,

        If(Day($1)<=Day(Today()),1,0) AS [InMTD] ,

        12*Year(Today())+Month(Today())-12*Year($1)-Month($1) AS [MonthsAgo] ,

        Month(Today())-Month($1) AS [MonthRelNo] ,

        If(WeekDay($1)<=WeekDay(Today()),1,0) AS [InWTD] ,

        (WeekStart(Today())-WeekStart($1))/7 AS [WeeksAgo] ,

        Week(Today())-Week($1) AS [WeekRelNo] ;

       

       

      DERIVE FIELDS FROM FIELDS [ED_ConversionOrderDateTime], [EKGCompleteDateTime], [ED_TriageBeginDateTime], [ED_TriageEndDateTime], [ED_ReadyForTransportDateTime],

      [ED_ArrivalDateTime], [ED_RegistrationDateTime], [ED_TimeSeenByProviderDateTime], [ED_BedInProgress], [ED_BedDateTime], [ED_HUC_DateTime], [ED_HUM_DateTime],

      [ED_HUO_DateTime], [ED_HUT_DateTime], [ED_Hold_DateTime], [ED_TBT_DateTime], [ED_WMD_DateTime], [ED_PDC_DateTime], [ED_PendAdmDateTime], [ED_ADM_IN_DateTime],

      [ED_ADM_OBS_DateTime], [ED_AdmitBedReserveDateTime], [ED_ExpiredDateTime] USING [autoCalendar];

       

      //my store script below

      Store autoCalendar into  [lib://QVDS/Calendar.qvd]

      (qvd);

       

      If anyone has any Idea How I can either include the autocalendar as part of table QVD (like join it to the actual table from which the date fields are being derived)

       

      or  store a separate QVD

       

      Please help.  I know I can create a master Calendar but as you can see if have over 15 date time field and creating a master calendar for each one would be tedious. 

       

      Please help.

       

      Thank you,