Parsing RecurrenceRule server side

11 posts, 0 answers
  1. jonno
    jonno avatar
    6 posts
    Member since:
    Nov 2011

    Posted 15 Feb 2014 Link to this post

    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?
  2. jonno
    jonno avatar
    6 posts
    Member since:
    Nov 2011

    Posted 15 Feb 2014 Link to this post

    This article: http://www.telerik.com/forums/regular-expression-to-parse-recurrenceruleClose
  3. Kendo UI is VS 2017 Ready
  4. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 17 Feb 2014 Link to this post

    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!
  5. jonno
    jonno avatar
    6 posts
    Member since:
    Nov 2011

    Posted 23 Feb 2014 in reply to Georgi Krustev Link to this post

    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
  6. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 25 Feb 2014 Link to this post

    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!
  7. Denis Buchwald
    Denis Buchwald avatar
    28 posts
    Member since:
    Apr 2010

    Posted 22 Apr 2015 in reply to Georgi Krustev Link to this post

    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?

     

     

  8. Denis Buchwald
    Denis Buchwald avatar
    28 posts
    Member since:
    Apr 2010

    Posted 22 Apr 2015 in reply to Denis Buchwald Link to this post

    Georgi:

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

  9. Denis Buchwald
    Denis Buchwald avatar
    28 posts
    Member since:
    Apr 2010

    Posted 22 Apr 2015 Link to this post

    Here is the attached image of my code. Can you tell me why this recurrenceRule fails to parse?
  10. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 27 Apr 2015 Link to this post

    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!
     
  11. Alfredo
    Alfredo avatar
    3 posts
    Member since:
    Feb 2013

    Posted 21 Oct in reply to Georgi Krustev Link to this post

    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.

  12. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 25 Oct Link to this post

    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.
     
Back to Top
Kendo UI is VS 2017 Ready