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

Parsing RecurrenceRule server side

10 Answers 806 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
jonno
Top achievements
Rank 1
jonno asked on 15 Feb 2014, 06:17 AM
I need to parse a scheduled event's recurrence rule server side in order to calculate which events will trigger in the coming week. A job runs periodically on the server to do this and is not driven from the UI, so using a Kendo client library does not help.

This article suggests using the RecurrenceRule class (provided with the UI for ASP.NET AJAX product). The problem I'm having is not all recurrence expressions generated by Kendo Web Scheduler parse correctly using this class, e.g.:

Parse success: FREQ=DAILY;INTERVAL=3;WKST=MO
Parse success: FREQ=WEEKLY;INTERVAL=3;BYDAY=WE;WKST=MO
ERROR - Parse exception: FREQ=MONTHLY;BYMONTHDAY=5
ERROR - Parse exception: FREQ=WEEKLY;BYDAY=MO

Is the RecurrenceRule class able to parse all expressions generated by Kendo Web Scheduler?

If not, what do suggest is the best approach to take and do you have a regex definition for the recurrence rule pattern in Kendo Web?

10 Answers, 1 is accepted

Sort by
0
jonno
Top achievements
Rank 1
answered on 15 Feb 2014, 06:20 AM
This article: http://www.telerik.com/forums/regular-expression-to-parse-recurrenceruleClose
0
Georgi Krustev
Telerik team
answered on 17 Feb 2014, 09:45 AM
Hello jonno,

Kendo Scheduler supports expanding recurrence event only on client-side. The supported recurrence rule is defined in RFC 5545.

Regarding your specific question, I will need more information in order to continue our investigation. It will be very helpful if you can send us your test project, where the required functionality is implemented.

As a side note, you can try DDay.iCal library which is open source. I attached a simple test project to this message.


Regards,
Georgi Krustev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
jonno
Top achievements
Rank 1
answered on 23 Feb 2014, 07:12 AM
Test project attached. What I've done is create a number of schedules with recurring events using Kendo Web Scheduler, copied the recurrence rules into the test program, and then tried to parse the recurrence rule using Telerik.Web.UI RecurrenceRule class. A number of them do not parse.

The objective here is to figure out which scheduled events will fire in the next week using server side code that runs periodically.

Also, can you attach DDay.iCal test project mentioned in your reply - it's not attached.

thanks
0
Georgi Krustev
Telerik team
answered on 25 Feb 2014, 02:10 PM
Hello again jonno,

Probably something went wrong with the attachment. Sorry for that. I attached it again. 

As to the exceptions thrown by RecurrenceRule.TryParse, I noticed that it is caused when INTERVAL rule is missing. If you want to use the RecurrenceRule.TryParse method, you will need to add it manually.

Let me know if I can be of any further help.

Regards,
Georgi Krustev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Denis Buchwald
Top achievements
Rank 1
answered on 23 Apr 2015, 04:20 AM

Georgi: 

What is INTERVAL?

And how to set it?

Does it have any meaning to the rule? Is it going to impact the way RecurrenceRule parses? Is it going to limit occurrences in any way?

 

 

0
Denis Buchwald
Top achievements
Rank 1
answered on 23 Apr 2015, 04:51 AM

Georgi:

 Why recurrence rule "FREQ=DAILY;INTERVAL=1" still fails to parse?

0
Denis Buchwald
Top achievements
Rank 1
answered on 23 Apr 2015, 04:54 AM
Here is the attached image of my code. Can you tell me why this recurrenceRule fails to parse?
0
Georgi Krustev
Telerik team
answered on 27 Apr 2015, 06:58 AM
Hello Denis,

I would suggest you refer to the iCal specs for more details about the recurrence rules.

With regards to the DDay.iCal issue, I would suggest you refer to the library help and forums for further help.

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Alfredo
Top achievements
Rank 1
answered on 21 Oct 2016, 02:24 PM

Hello, I am the same issue, I need with a recurrence rule get all the dates to create in DB a specific event for each one,  but this code ever return null RecurrenceRule, I read ICal spec and exist a function to determine conflict with getOcurrence with a date range, but nothing like I need.

      RecurrenceRule recRule = null;
            var b = RecurrenceRule.TryParse(recurrenceRule, out recurrenceRule);

I try manually like this post : http://stackoverflow.com/questions/23729725/telerik-recurrencerule-tryparse-not-working

but still not working

I need the funcionallity to do anything like that

 

  public static IEnumerable<Tuple<DateTime, DateTime>> GetRecurrenceValuesAndRuleAndGetRecurrenceDates(DateTime recurrenceStart, DateTime recurrenceEnd
            , string recurrenceRule)
        {
            Func<DateTime, DateTime, DateTime> mergeDate
                    = (dateValues, hourValues) => new DateTime(dateValues.Year, dateValues.Month, dateValues.Day, hourValues.Hour, hourValues.Minute, 0);



            //var rrule = string.Format("DTSTART:{0:yyyyMMddTHHmmssZ}\r\nDTEND:{1:yyyyMMddTHHmmssZ}\r\nRRULE:{2}", recurrenceStart, recurrenceEnd, recurrenceEnd);

            RecurrenceRule recRule = null;
            var b = RecurrenceRule.TryParse(recurrenceRule, out recurrenceRule);

            foreach (var date in recRule.Occurrences)
            {
                var tempStart = mergeDate.Invoke(date, recurrenceStart);
                var tempEnd = mergeDate.Invoke(date, recurrenceEnd);

                yield return new Tuple<DateTime, DateTime>(tempStart, tempEnd);
            }
        }

Please i need support becasue I cant save an scheduler event like one unique record in my database.

Regards.

0
Georgi Krustev
Telerik team
answered on 25 Oct 2016, 08:37 AM
Hello Afredo,

In general, the Kendo UI Scheduler widget expands recurring events on the client. In other words our built-in recurrence engine works only on the client. The generated recurrence rules follow the RFC5545 specifications, which should be enough to use a compatible library that could expand the events on the server.

I am afraid that we would not be able to provide more detailed steps as the desired functionality is not supported by the Kendo UI library and as such falls out of the scope of the entitled support service. If you need further assistance on the subject, please contact our Professional Services. 

Regards,
Georgi Krustev
Telerik by Progress
 
Build rich, delightful, *native* Angular 2 apps with Kendo UI for Angular 2. Try it out today! Kendo UI for Angular 2 (currently in beta) is a jQuery-free toolset, written in TypeScript, designed from the ground up to offer true, native Angular 2 components.
 
Tags
Scheduler
Asked by
jonno
Top achievements
Rank 1
Answers by
jonno
Top achievements
Rank 1
Georgi Krustev
Telerik team
Denis Buchwald
Top achievements
Rank 1
Alfredo
Top achievements
Rank 1
Share this question
or