This is a migrated thread and some comments may be shown as answers.

RadScheduler Recurrence Engine

7 Answers 608 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Carlo DiCelico
Top achievements
Rank 1
Carlo DiCelico asked on 23 Oct 2007, 02:24 PM

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.

7 Answers, 1 is accepted

Sort by
0
Ryan
Top achievements
Rank 1
answered on 23 Jan 2008, 09:48 PM
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?"
0
T. Tsonev
Telerik team
answered on 24 Jan 2008, 07:15 AM
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
0
Ryan
Top achievements
Rank 1
answered on 24 Jan 2008, 12:45 PM
Thanks for the fast response.
0
Eugene
Top achievements
Rank 1
answered on 01 May 2019, 09:25 PM
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?
0
Peter Milchev
Telerik team
answered on 03 May 2019, 01:50 PM
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.
0
Vicente
Top achievements
Rank 1
answered on 26 Nov 2019, 03:11 PM

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)

0
Peter Milchev
Telerik team
answered on 27 Nov 2019, 12:12 PM

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.
Tags
Scheduler
Asked by
Carlo DiCelico
Top achievements
Rank 1
Answers by
Ryan
Top achievements
Rank 1
T. Tsonev
Telerik team
Eugene
Top achievements
Rank 1
Peter Milchev
Telerik team
Vicente
Top achievements
Rank 1
Share this question
or