RadScheduler Recurrence Engine

8 posts, 0 answers
  1. Carlo DiCelico
    Carlo DiCelico avatar
    15 posts
    Member since:
    Sep 2007

    Posted 23 Oct 2007 Link to this post

    What would be the best way to store the RecurrenceRule and the RecurrenceParentId in the database? Would varchar and int, respectively, be the best data types to use in SQL?

    Also, what would be the best way to translate a recurrence rule into something I can use somewhere else? For example, if I wanted to populate a DropDownList control with appointment titles and then upon SelectedIndexChanged, populate the second DropDownList with all of the available (recurring) time slots, would that be possible? If so, what would be the best way of going about it?

    Thanks.

  2. Ryan
    Ryan avatar
    14 posts
    Member since:
    Sep 2007

    Posted 23 Jan 2008 Link to this post

    I would like to know the answer to Carlo's first question:

    "What would be the best way to store the RecurrenceRule and the RecurrenceParentId in the database? Would varchar and int, respectively, be the best data types to use in SQL?"
  3. T. Tsonev
    Admin
    T. Tsonev avatar
    2822 posts

    Posted 24 Jan 2008 Link to this post

    Hi Ryan,

    The recommended storage for RecurrenceRule is varchar with maximum size of about 1024 characters. Most recurrence rules take much less and the extra space is needed for appending exception dates.

    The RecurrenceParentID field is a foreign key pointing to the primary key, so it must be of the same type as the PK.

    In order to make sense of the recurrence rule it should be parsed first. The Telerik.Web.UI.RecurrenceRule class makes this task easy. The following example first builds a recurrence rule, then converts it to string (as for storage in a database) and finally parses it and outputs the occurrence dates:

    using System; 
    using Telerik.Web.UI; 
    namespace RecurrenceExamples 
       class ParsingExample 
       { 
           static void Main() 
           { 
               // Creates a sample appointment that starts at 6/1/2007 3:30 PM (local time) and lasts half an hour. 
               Appointment recurringAppointment = new Appointment("1", Convert.ToDateTime("6/1/2007 3:30 PM"), 
                   Convert.ToDateTime("6/1/2007 4:00 PM"), "Sample appointment"); 
               // Creates a recurrence range, that specifies a limit of 10 occurrences for the appointment. 
               RecurrenceRange range = new RecurrenceRange(); 
               range.Start = recurringAppointment.Start; 
               range.EventDuration = recurringAppointment.End - recurringAppointment.Start; 
               range.MaxOccurences = 10; 
               // Creates a recurrence rule to repeat the appointment every 2 hours. 
               HourlyRecurrenceRule rrule = new HourlyRecurrenceRule(2, range); 
               Console.WriteLine("The appointment recurs at the following times"); 
               foreach (DateTime occurrence in rrule.Occurrences) 
               { 
                   Console.WriteLine("\t{0}", occurrence); 
               } 
               Console.WriteLine(); 
               // Prints the string representation of the recurrence rule: 
               string rruleAsString = rrule.ToString(); 
               Console.WriteLine("Recurrence rule:\n\n{0}\n", rruleAsString); 
               // The string representation can be stored in a database, etc. 
               // ... 
               // Then it can be reconstructed using TryParse method: 
               RecurrenceRule parsedRule; 
               RecurrenceRule.TryParse(rruleAsString, out parsedRule); 
               Console.WriteLine("After parsing (should be the same):\n\n{0}", parsedRule); 
           } 
       } 
    }  

    More information in the online documentation.

    Kind regards,
    Tsvetomir Tsonev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  4. Ryan
    Ryan avatar
    14 posts
    Member since:
    Sep 2007

    Posted 24 Jan 2008 Link to this post

    Thanks for the fast response.
  5. Eugene
    Eugene avatar
    1 posts
    Member since:
    May 2013

    Posted 01 May 2019 Link to this post

    First, I apologize for resurrecting this thread nearly a decade later.  Is there any problem setting the column size larger than varchar(1024)?  I am working with a system in which client users are occasionally setting recurring appointments in which the recurrence rule data size hits the 1024 character limit and starts causing issues with the calendar.  I know this control is old but would like to avoid the effort of changing out this control because of a column size?
  6. Peter Milchev
    Admin
    Peter Milchev avatar
    654 posts

    Posted 03 May 2019 Link to this post

    Hello Eugene,

    The recommended size is 1024 for optimization purposes, as it is rarely the case when there are so many exception dates that the total string count exceeds 1024 characters. 

    With that said, there should be no issue with increasing the number of characters limit.

    Regards,
    Peter Milchev
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  7. Vicente
    Vicente avatar
    1 posts
    Member since:
    Jul 2016

    Posted 26 Nov 2019 in reply to Peter Milchev Link to this post

    I have an application that require lots of exceptions. At certain point, radscheduler stopped recording those.

    The pattern or appointments that fail accepting the change is that the fielr RecurrenceRule are near the 1024 limit. I have doubled the field size to 2048 but still radscheduler will not process the new exception. Is there another place on radscheduler that I have to make an adjustment ?  Database is SQL server 2014 and my Telerik version is UI for ASP.NET AJAX R1 2019 SP1 (version 2019.1.215)

  8. Peter Milchev
    Admin
    Peter Milchev avatar
    654 posts

    Posted 27 Nov 2019 Link to this post

    Hello Vicente,

    The RadScheduler does not care about the length of the recurrence rules, so you can set the field size to an even bigger number. 

    There might be a possibility if when trying to save the recurrence rule, the SQL cut the text and that would lead to an invalid recurrence rule.

    Please try creating a new appointment to the data base and start adding exceptions until the issue is observed again. It should work properly until the limit of the column size is met.

    Regards,
    Peter Milchev
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top