Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
297
Monthly Recurrence Pattern
posted

I have a custom add appointment form and have discovered I'm not storing the monthly recurring appointments correctly.  I am storing and displaying the monthly recurrences correctly if it is the ? day of every ? month pattern, but it's the second pattern not storing or pulling correctly.  Can anyone tell me how this data is stored in the recurrence table? (What the column data entries wouldbe)  Such as: the First Friday of Every 1 Month  -or-  the Second Tuesday of Every 1 Month -or- the Last Day of Every 2 Months?   What would these values be in the recurrence table?  Can't seem to find any documentation readily available....

 Thanks!

Terri

  • 4960
    Verified Answer
    posted

    tgaudette said:

    Can anyone tell me how this data is stored in the recurrence table?   

    The following help topic explains the data model of the recurrence table:

    There is a little bit of impedance-matching that occurs when this gets mapped to the properties of a Recurrence object, those properties you can get the description via this page:

    Herein lies the distinction between recurrence patterns "of the first kind" and recurrence patterns "of the second kind."  When the recurrence is a "first", "second", ..., "last" kind of pattern then it doesn't need to store an explicit DayOfMonth in the data model, so instead it stores a negative integer in the DayOfMonth column corresponding to RecurrenceDayOfMonth.First (-1), RecurrenceDayOfMonth.Second (-2), etc.

    tgaudette said:

    (What the column data entries wouldbe)  Such as: the First Friday of Every 1 Month  -or-  the Second Tuesday of Every 1 Month -or- the Last Day of Every 2 Months?

    • First Friday of Every 1 Month
      [DayOfMonth] = -1, [DayOfWeekMaskUtc] = 32, [PeriodMultiple] = 1, [Period] = N'M'
    • Second Tuesday of Every 1 Month
      [DayOfMonth] = -2, [DayOfWeekMaskUtc] = 4, [PeriodMultiple] = 1, [Period] = N'M'
    • Last Day of Every 2 Months
      [DayOfMonth] = -5, [DayOfWeekMaskUtc] = 127, [PeriodMultiple] = 2, [Period] = N'M'