Get list of appointments server side based on start & end date

Can you get a list from the database containing all appointments between 2 dates? The question relates to recurrence rules and possible exceptions. 

Based on the table format, I would query the startdate and enddate, but how do I transform this resultset into a list of appointments taking into account all recurrence exceptions/appointments.

I have 2 business cases for this:
  1. I need a list of appointments to be shown outside the Schedule control. The client requires batch operations on the appointments (changing status, assigning different room, ...). 
  2. I need a server side export to ical format so external agenda's (google, outlook, ...) can subscribe to the schedule data and we can implement at least a one-way sync.
The code needs to be in the controller so please no client side JS solution. Is there a helper method to parse the rows from the SQL query into a list of appointments.

3 Replies

VM Vengatesh Maniraj Syncfusion Team August 19, 2020 10:25 AM UTC

Hi Jan, 

Greetings from Syncfusion Support. 

We have checked your requirement and yes, we have the helper to parse the recurrence rule and exception between 2 days. For more reference, please refer to the below KB. 


I need a list of appointments to be shown outside the Schedule control. The client requires batch operations on the appointments (changing status, assigning different room, ...). 
Kindly try the above recurrence helper that returns the list of data based on the date.  

I need a server side export to ical format so external agenda's (google, outlook, ...) can subscribe to the schedule data and we can implement at least a one-way sync. 
We regret to let you know that server side export to ical is not feasible with our current schedule’s architecture.  

Please get back to us if you need any further assistance. 

Regards, 
Vengatesh  



JG Jan Gils August 19, 2020 01:26 PM UTC

Hi Vengatesh,

thanks for your answer. I already saw the helper class, but I'm afraid it doesn't cover everything if I'm looking at the database fields:


Aren't the fields "RecurrenceId" and "ReccurenceDateEx" necessary for calculating the correct appointments? If not, why do these fields exist?

As for the ical export, we can do this server side, but need a full list of all appointments between 2 dates server side.


HB Hareesh Balasubramanian Syncfusion Team August 20, 2020 03:14 PM UTC

Hi Jan, 

Thanks for the update. 

We have validated both the queries at our end and for that, we have prepared a CRUD sample and it can be downloaded from the following link, 

Q1: Aren't the fields "RecurrenceId" and "ReccurenceDateEx" necessary for calculating the correct appointments? If not, why do these fields exist? 
 
If we edit a particular occurrence from a Recurrence event series and display it on the initial load of Scheduler, the edited occurrence needs to be added as a new event to the dataSource collection, with an additional RecurrenceID field defined to it. The RecurrenceID field of edited occurrence usually maps the ID value of the parent event. 
 
For instance, in the above sample, a recurring instance that displays on the date 25th April 2018 is edited with different timings. Therefore, this particular date is excluded from the parent recurring event that repeats from 23rd April 2018 to 25th April 2018. This can be done by adding the RecurrenceException field with the excluded date value on the parent event. Also, the edited occurrence event which is created as a new event should carry the RecurrenceID field pointing to the parent event’s Id value. 
 
And the same can be viewed in the above sample and also we have taken a screenshot of the events collection of the above sample, 
 
 
And for further reference, kindly refer the below UG link, 

Q2: As for the ical export, we can do this server side, but need a full list of all appointments between 2 dates server side 
 
For this query, we suspect that your requirement is to get the event collections based on the dates and for that, we have rendered the Scheduler events based on the Scheduler current view rendering dates in that you can render you own customized dates (i.e.,) the events to get from the event collections based on those dates and for further reference, kindly refer the below code snippet and the same can be viewed in the above sample. 
 
Code snippet: 
        public JsonResult LoadData(Params param)  // Here we get the Start and End Date and based on that can filter the data and return to Scheduler 
        { 
            DateTime start = param.StartDate; 
            DateTime end = param.EndDate; 
            var data = db.ScheduleEventDatas.Where(app => (app.StartTime >= start && app.StartTime <= end) || (app.RecurrenceRule != null && app.RecurrenceRule != "")).ToList();  // Here filtering the events based on the start and end date value. 
            return Json(data, JsonRequestBehavior.AllowGet); 
        } 
 
Kindly try the above solution and get back to us if you need any further assistance. 
 
Regards, 
Hareesh 


Loader.
Up arrow icon