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

Query Events that will occur within 7 Days

5 Answers 85 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Nick S
Top achievements
Rank 1
Nick S asked on 07 Dec 2009, 05:47 PM
Hi, is there a way I can query all events that will occur between now and the next 7 days?  I need to include individual recurrence events as well.
Thank you

5 Answers, 1 is accepted

Sort by
0
Accepted
Dimitar Milushev
Telerik team
answered on 10 Dec 2009, 04:08 PM
Hi Nick S,

You can use the following code:

C#
RadScheduler1.DataBind();
IList<Appointment> appointments = RadScheduler1.Appointments.GetAppointmentsInRange(Now.Date, Now.Date.AddDays(7));

VB.NET
RadScheduler1.DataBind()
Dim appointments As IList(Of Appointment) = RadScheduler1.Appointments.GetAppointmentsInRange(Now.Date, Now.Date.AddDays(7))


Best wishes,
Dimitar Milushev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Andrew N
Top achievements
Rank 1
answered on 01 Apr 2010, 03:46 AM
This does not seem to be working with recurrences in my case. The recurrence shows a start and end date of 3-29-10 with a patter to recurr over the next 10 days. If I run it to bring back appointments between now (3-30-10) and days(2) is doesn't bring back any of the recurrence events. I must be missing something. Thanks for any help!
0
Peter
Telerik team
answered on 01 Apr 2010, 01:01 PM
Hello Andrew N,

To make sure that you don't miss any occurrence you need to loop through all appointments of RadScheduler and check what their recurrence state is. If it is 'Master' then you need to parse the recurrence rule which will create a collection of all occurrences. Then you need to loop through this collection and check for each occurrence if it falls within a specified time range. Here are a help topic and a kb article for reference:

Working with Recurring Appointments

How to display all RadScheduler appointments in GridView 


Regards,
Peter
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Andrew N
Top achievements
Rank 1
answered on 01 Apr 2010, 06:18 PM
Peter, thanks for the quick response.

Here is something I did that seems to have remedied the problem for me.

I set the Schedule viewtype to Timeline with a schedule date of today

Now when I query the schedule object with getappointmentsinrange it appears to work fine, even if the recurrence starts before the first date of hte timeline.

Does that make sense? It's working for me at this point, so I'm happy with that!

-Andrew

P.S. I should note I figured this out because I did appointment counts for my resulting ilist and displayed them while advancing the schedule days and weeks in each view and noticed the count of appointments changed with each view and I could not put a finger on exactly how it was working. When I went to a timeline view the resulting counts were much more predictable to what I was seeing in the view.
0
T. Tsonev
Telerik team
answered on 02 Apr 2010, 02:48 PM
Hello Andrew,

I'm glad that you've managed to solve the problem.

Indeed TimelineView will be most predictable, as it does very simple appointment filtering. Other views might have more complex and less predictable rules.

Recurring appointments are always evaluated even if they start outside of the current view. So no need to worry about them.

Best wishes,
Tsvetomir Tsonev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Scheduler
Asked by
Nick S
Top achievements
Rank 1
Answers by
Dimitar Milushev
Telerik team
Andrew N
Top achievements
Rank 1
Peter
Telerik team
T. Tsonev
Telerik team
Share this question
or