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

Why doesn't this recur?

11 Answers 99 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Brian Mains
Top achievements
Rank 1
Brian Mains asked on 08 Dec 2008, 09:53 PM
Hello,

Why doesn't this recur?  In the backend database, I have this:

DTSTART:20081208T090000Z  DTEND:20081208T113000Z  RRULE:FREQ=DAILY;UNTIL=20090227T000000Z;INTERVAL=1 

For one appointment entry.  I have the 

DataRecurrenceField and the 

 

DataRecurrenceParentKeyField

set correctly, but no recurring appointments, not even the original 12/8 appointment.  Why is that?  This is the only feature in the scheduler that does not just want to work, and I desperately need it to.

Thanks.

11 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 09 Dec 2008, 03:23 PM
Hello Brian,

I think the problem is with the recurrence string. Please, use "\r\n" to represent a new line. Here is an example:

private void InitializeAppointments()  
        {  
            string strRecurrence = "DTSTART:20070330T063000Z\r\nDTEND:20070330T073000Z\r\nRRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20070406T073000Z;BYDAY=MO,TU,WE,TH,FR;\r\n";  
 
              
            DateTime recStart = Convert.ToDateTime("3/30/2007 6:30:00 AM");  
            DateTime recEnd = Convert.ToDateTime("3/30/2007 7:30:00 AM");  
 
            Appointments.Add(new AppointmentInfo("test", recStart, recEnd, strRecurrence, null, 1));  
 

For your database, please make sure the new lines are stored correctly.

Does this help?


Sincerely yours,
Peter
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Brian Mains
Top achievements
Rank 1
answered on 09 Dec 2008, 04:50 PM
Hey,

It does seem to have helped, but I have another issue I have to figure out....  not sure if related to the assessment type yet.  But I do now see one of the recurring appointments.

Thanks.
0
Peter
Telerik team
answered on 09 Dec 2008, 04:58 PM
Hello Brian,

Could you please provide us with more details. What do you mean by assesment type? Do you programatically create and assign the recurrence string or do you use a database? It would be best if you can send us a small working demo project.

Regards,
Peter
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Tonya
Top achievements
Rank 1
answered on 10 Dec 2008, 03:42 PM
Peter,

Would it possible to see the same demo you have provided in VB.NET?  The reason I ask is because I don't believe I have access to an "AppointmentInfo" class.  After having some issues using my pre-constructed RecurrenceStrings that I store in a database I directly copied your example (replacing AppointmentInfo with Appointment, changing the times 2007 -> 2008, etc.) and haven't been able to get a working sample.

Below is what I've been working with:

(.aspx)

<telerik:RadScheduler ID="rsEvents" runat="server" 
            EnableEmbeddedSkins="True"  
            Skin="Default"  
            AllowDelete="false"  
            AllowEdit="false"  
            AllowInsert="False" 
            DayStartTime="08:00:00"  
            DayEndTime="18:00:00"  
            TimeZoneOffset="03:00:00"  
            Width="925px"  
            Height="600px"  
            DataRecurrenceField="RecurrenceRule"  
            DataRecurrenceParentKeyField="RecurrenceParentID" 
            DataKeyField="ID"  
            DataSubjectField="Subject"  
            DataStartField="Start"  
            DataEndField="End"  
            CustomAttributeNames="Subject" >   
            <TimelineView UserSelectable="false" /> 
             
            <AppointmentTemplate> 
              <href=''><%#Eval("Subject")%></a>           
            </AppointmentTemplate>                   
</telerik:RadScheduler> 

(.aspx.vb)

Dim strRecurrence As String = "DTSTART:20081208T080000Z\r\nDTEND:20081208T090000Z\r\nRRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20081224T090000Z;BYDAY=MO,TU,WE,TH,FR;\r\n" 
 
Dim recStart As DateTime = CType("12/8/2008 8:00:00 AM", DateTime) 
Dim recEnd As DateTime = CType("12/8/2008 9:00:00 AM", DateTime) 
Appointments.Add(New Appointment("Test", recStart, recEnd, "Test", strRecurrence, Nothing, 1)) 

Thanks in advance for any help!

Kyle



0
Peter
Telerik team
answered on 11 Dec 2008, 03:27 PM
Hello Kyle,

I have prepared a demo sample in VB.NET which you can use for reference. I have used the Binding to generic list example and I have added one more appointment which is recurring weekly on Thursday for 10 weeks. Here is the relevant code:

     'test for recurring appointment  
        Dim startTime As New DateTime(2008, 12, 11, 9, 0, 0)  
        Dim range1 As New RecurrenceRange(startTime, New TimeSpan(1, 0, 0), DateTime.MaxValue, 10)  
        Dim rule1 As New WeeklyRecurrenceRule(1, RecurrenceDay.Thursday, range1)  
        Appointments.Add(New AppointmentInfo("recurring appointment", startTime, startTime.AddHours(1), rule1.ToString(), Nothing, 1))  
 



All the best,
Peter
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Tonya
Top achievements
Rank 1
answered on 11 Dec 2008, 04:34 PM
Peter,

Thanks a ton! Works like a charm.

Kyle
0
Brian Mains
Top achievements
Rank 1
answered on 11 Dec 2008, 07:45 PM
Hey,

"Assessment type" is part of our business logic, so sorry for the confusion around that...  some of the issues was with my existing logic, so I managed to work through that.

Now, question for you about the editing existing recurrence appointments.  I'm assuming that the RecurrenceParentKey field is primarily used to track where the user changes an existing recurring appointment.  By that I mean the user selects one of the recurring instances, and select "edit this instance only" option.  I'm assuming that the recurrence parent key is used to tie that appointment to the original recurring appointment, but that it would be stored separately in the database?

Also, if I delete one instance from a recurring appointment, is there a special mechanism to handle that for the database?  I'm not binding through a data source control or the provider class, but manually (DataSource property).  I've gotten most of this to work; I'm just down to these last pieces and that's where my confusion lies.

Thanks.
0
Peter
Telerik team
answered on 12 Dec 2008, 12:55 PM
Hi Brian,

Your assumptions are correct. For more information you can refer to the topic on Working with Recurring Appointments:
http://www.telerik.com/help/aspnet-ajax/schedule_serversideworkingwithrecurringappointments.html

I am not sure though what exactly you are trying to achieve. Could you please be more specific?


All the best,
Peter
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Brian Mains
Top achievements
Rank 1
answered on 12 Dec 2008, 04:49 PM
Hey,

What I want to know is how does deleting an appointment by a single occurrence, in a recurring appointment, work?  How do you set that up when you are manually binding a data source to the scheduler?  I tapped into the AppointmentDelete event, but am not sure what my next step should be when an appointment is recurring...

How does the scheduler say "this is a recurring appointment, but it doesn't recur in this specific instance because it was deleted."  Thanks.
0
Brian Mains
Top achievements
Rank 1
answered on 13 Dec 2008, 07:23 PM
Also, I'm trying to figure out how to handle exceptions (deleting one instance of a recurring appointment, editing one instance, etc.) and how the scheduler handles this....  I understand it embeds it in the rule section, but I don't quite get how that works...
0
Peter
Telerik team
answered on 15 Dec 2008, 03:40 PM

A provider class demonstrates best how to handle recurrence from code. Please, find the MyDbSchedulerProvider attached to this reply.


Greetings,
Peter
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Scheduler
Asked by
Brian Mains
Top achievements
Rank 1
Answers by
Peter
Telerik team
Brian Mains
Top achievements
Rank 1
Tonya
Top achievements
Rank 1
Share this question
or