Get dates from recurrence pattern |
Post Reply |
Author | |
DataFlowJoe
Groupie Joined: 30 October 2007 Status: Offline Points: 12 |
Post Options
Thanks(0)
Posted: 16 April 2009 at 2:13pm |
Can anyone show me how to decipher the recurrence pattern table so I can work out an algorithm for enumerating all the dates.
Is there an example on this forum, I had a look but couldn't find anything. I'll be using VB.
Thanks in advance,
Joe
|
|
He is no fool who gives what he cannot keep to gain what he cannot lose. (Jim Elliott)
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
You can do it using existed ActiveX interface
|
|
DataFlowJoe
Groupie Joined: 30 October 2007 Status: Offline Points: 12 |
Post Options
Thanks(0)
|
I'm using the microsoft access provider, are you able to give me an example of how I could achieve this using the ActiveX interface. I have found the help file has very few examples of how to work with the calendar ActiveX control.
Thanks in advance,
|
|
He is no fool who gives what he cannot keep to gain what he cannot lose. (Jim Elliott)
|
|
DataFlowJoe
Groupie Joined: 30 October 2007 Status: Offline Points: 12 |
Post Options
Thanks(0)
|
Can anyone provide me with a simple example for retrieving all events including recurring events between 2 dates. This must be quite simple, yet I've searched the forum and the help file but have not found anything suitable.
I'm not using a custom provider, just an Access connection string.
I'm happy to create an ADO connection if that is required.
My programming language is VB.
Please...please help, I'm desperate for this, I've spent at least 10 hrs fiddling around with this so far.
Thanks in advance.
Hopefully I'll be able to help this forum in the future.
Joe
|
|
He is no fool who gives what he cannot keep to gain what he cannot lose. (Jim Elliott)
|
|
dentor
Senior Member Joined: 30 November 2005 Location: France Status: Offline Points: 102 |
Post Options
Thanks(0)
|
Hello DataFlowJoe,
I think that the better way to retrieve all the events including recurring events is to use the RetrieveDayEvents method from the CalendarControl ActiveX that will do all the work.
Below a little code to quickly show one way to do the job:
' ---------- the definition of the events collection to be return (can be extented)
Private Type MyEvents
StartTime As Date EndTime As Date Subject As String End Type ' ---------- The call of the subroutine
Private Sub FindEvents()
Dim FindEvents() As MyEvents, EvtCount As Long Dim DateStart As Date, DateEnd As Date Dim pEvent As CalendarEvent, i As Long ' *** Find events from now plus 6 days
EvtCount = 0 ReDim FindEvents(EvtCount) DateStart = Now DateEnd = DateAdd("d", 6, DateStart) ' *** the subroutine FindAllEvents DateStart, DateEnd, EvtCount, FindEvents() ' *** view the events For i = 1 To EvtCount Debug.Print FindEvents(i).StartTime & "-" & FindEvents(i).EndTime & "-" & FindEvents(i).Subject Next End Sub ' ---------- The subroutine (the search for each day in the periode)
Private Sub FindAllEvents(DateStart As Date, DateEnd As Date, EvtCount As Long, FindEvents() As MyEvents)
Dim Events As CalendarEvents, Day As Date Dim pEvent As CalendarEvent Day = DateStart
Do Set Events = CalendarControl.DataProvider.RetrieveDayEvents(Day) For Each pEvent In Events EvtCount = EvtCount + 1 ReDim Preserve FindEvents(EvtCount) FindEvents(EvtCount).StartTime = pEvent.StartTime FindEvents(EvtCount).EndTime = pEvent.EndTime FindEvents(EvtCount).Subject = pEvent.Subject Next Day = DateAdd("d", 1, Day) Loop Until Day > DateEnd End Sub I hope it can help you.
|
|
Product: Xtreme SuitePro (ActiveX) version 13.0.0
Platform: Windows XP (32bit) - SP 3 Language: Visual Basic 6.0 SP 6 |
|
DataFlowJoe
Groupie Joined: 30 October 2007 Status: Offline Points: 12 |
Post Options
Thanks(0)
|
Hi Dentor,
This is perfect....!! I've now got it working and doing what I hoped it could do.
Thank you so much for helping me out with this, I'm sure the calendar ActiveX would be an even better product for developers if there were more examples like the one you've posted for me.
The help file that comes with the control hardly has any examples for working with the scores of properties, methods and events.
Better documentation would get developers up to speed a lot quicker with it.
The control itself is brilliant in what it does, so no complaints there.
Thanks again for taking the time to answer my question, hopefully it will benefit others.
Cheers from South Wales UK
|
|
He is no fool who gives what he cannot keep to gain what he cannot lose. (Jim Elliott)
|
|
jgordon428
Groupie Joined: 11 June 2009 Status: Offline Points: 21 |
Post Options
Thanks(0)
|
Has anyone figured out a way to do this in a SQL Server stored procedure? There are parts of our system that require the scheduling data to be in a recordset format (e.g. crystal reports, searching for available time slots, etc.). Having a stored procedure to handle the recurrence expansion rather than using the ActiveX control and then inserting records into a temporary table would be hugely helpful.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |