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

[Solved] How can I set a Daily Recurrence Rule With Interval to ignore weekends

2 Answers 444 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Tony
Top achievements
Rank 2
Tony asked on 18 Apr 2008, 05:00 PM
Hi,

I am trying to create a Monday - Friday rotational schedule based on a three man team for a set month. 

Week 1: A,B,C,A,B
Week 2: C,A,B,C,A
Week 3: B,C,A,B,C
Week 4: A,B,C,A,B
etc, etc...

I know the pattern repeats every 4 weeks however each month can be the start of a new pattern meaning that the pattern does not continue from month to month and there are also holidays we need to consider ( I can Edit those individually).  Also, using the daily frequency rule I would create 1 entry/person  instead of 4 different entries/person.  The easiest way I felt in accomplishing this was to create a daily frequency with an Interval of three with an Abosolute start and end date. I created the following rule for 1 of the empoyees for the month of April.  

DTSTART:20080401T000000Z
DTEND:20080402T000000Z
RRULE:FREQ=DAILY;
UNTIL=20080501T000000Z;
INTERVAL=3;
BYDAY=MO,TU,WE,TH,FR

I changed the DaysOfWeekMask to WeekDays in the SQLDatasources Inserting Event.    Here is my code bellow
        Dim recRuleConverter As New Telerik.Web.UI.RecurrenceRuleConverter  
        Dim recRuleParamString As String = e.Command.Parameters("@RecurrenceRule").Value  
        If recRuleParamString <> "" Then  
            Dim recRule As Telerik.Web.UI.RecurrenceRule = recRuleConverter.ConvertFromString(recRuleParamString)  
            Select Case recRule.Pattern.Frequency  
                Case Telerik.Web.UI.RecurrenceFrequency.Daily  
                    With CType(recRule, Telerik.Web.UI.DailyRecurrenceRule)  
                        .DaysOfWeekMask = Telerik.Web.UI.RecurrenceDay.WeekDays  
                        With e.Command  
                            .Parameters("@RecurrenceRule").Value = recRule.ToString  
 
                        End With  
                    End With  
            End Select  
        End If 
The code makes sense to me however when the schedule gets loaded, RadSchedule ignores the interval and displays an Item on each day Monday Through Friday.

I want to use the daily frequency interval but ignore saturday and sunday.  Is this a bug or is there another way of doing this.  I dont think the daily frequency rule was intended to be used that way, but would be a good enhancemnet

2 Answers, 1 is accepted

Sort by
0
Tony
Top achievements
Rank 2
answered on 22 Apr 2008, 05:45 PM
Anyone from telerik going to take a stab at this??

Thanks
0
Dimitar Milushev
Telerik team
answered on 23 Apr 2008, 04:33 PM
Hello,

Unfortunately, RadScheduler currently uses either the DaysOfWeekMask or the Interval property of the DailyRecurrenceRule.

The problem is that it's not clear what should be the behavior of RadScheduler in both are set - if an occurrence of the appointment should appear in, let's say Saturday, according to the Interval rule, but the DaysOfWeekMask is to Weekdays only, should RadScheduler just skip the occurrence? Or should it show it in the next available day, skewing later occurrences forward (like in your case)?

A possible solution for your case would be to create a custom provider for RadScheduler and expand recurrences manually, making the necessary adjustments in process. You can find more information in the help documents - http://www.telerik.com/help/radcontrols/aspnet-ajax/?schedule_databindingimplementingaprovider.html.

Best wishes,
Dimitar Milushev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Scheduler
Asked by
Tony
Top achievements
Rank 2
Answers by
Tony
Top achievements
Rank 2
Dimitar Milushev
Telerik team
Share this question
or