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

Determine date of last occurence

3 Answers 57 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 08 Dec 2017, 11:56 AM

Hi,

I have a project where we are creating recurring appointments in the ScheduleView. The date of the last occurrence is very important to the rest of the system. Is there a built-in way to determine the actual date of the last occurrence of a recurring appointment? I am not allowing the "no date" or "end after x occurrences" options, only the "end by" option. However, I can't rely on this date, because the last occurrence can occur before this date.FYI: I have a number of database queries that work based on the actual end date of an appointment, so this is why I need to calculate the date of the last occurrence.

Thanks!

3 Answers, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 12 Dec 2017, 10:59 AM
Hello Dave,

If it is possible in your scenario, you can specify the RepeatUntil property which determines the end date of the appointment's occurrences. Or you can consider setting the MaxOccurrences property which specifies a limit of the occurrences for the appointment. This way setting this you can manually calculate the end date of the occurrence. These and more properties are further described in the RecurrencePattern help article in our documentation.

Give this suggestion a try and let me know if it works for you.

Regards,
Dinko
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Dave
Top achievements
Rank 1
answered on 12 Dec 2017, 12:34 PM

Hi Dinko,

Thanks for the reply. I was afraid this would be the answer. :) I was hoping that, since this logic is already built into the control, I could tap into it rather than have to re-invent what is already written. It's a bit more complex than you suggest because even if you set the RepeatUntil, that's not always the actual date of the last occurrence. For example, if I set an appointment that repeats weekly on Monday, the RepeatUntil date could be, for example, a Wednesday. I've tested this and it's possible. Plus, one needs to be concerned with exceptions. The last occurrence could be changed to occur after the RepeatUntil date. See the attached images. SUGGESTION: Expose a method on the component that returns an array of Appoinment objects that represent all of the appointments in a recurring appointment that has a finite recurrence pattern (excluding "No end date" scenarios).

0
Kalin
Telerik team
answered on 15 Dec 2017, 11:35 AM
Hello Dave,

Actually there is such method - check the static AppointmentExtensions.GetOccurrences method. It will return all the occurrences and exceptions for an appointment within given range.

Please give a try and let me know if you have any further questions or concerns.

Regards,
Kalin
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
ScheduleView
Asked by
Dave
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Dave
Top achievements
Rank 1
Kalin
Telerik team
Share this question
or