Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Calendar
  New Posts New Posts RSS Feed - Get dates from recurrence pattern
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Get dates from recurrence pattern

 Post Reply Post Reply
Author
Message
DataFlowJoe View Drop Down
Groupie
Groupie


Joined: 30 October 2007
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote DataFlowJoe Quote  Post ReplyReply Direct Link To This Post Topic: Get dates from recurrence pattern
    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)
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 16 April 2009 at 4:46pm
You can do it using existed ActiveX interface
Back to Top
DataFlowJoe View Drop Down
Groupie
Groupie


Joined: 30 October 2007
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote DataFlowJoe Quote  Post ReplyReply Direct Link To This Post Posted: 16 April 2009 at 5:59pm
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,
 
Joe
He is no fool who gives what he cannot keep to gain what he cannot lose. (Jim Elliott)
Back to Top
DataFlowJoe View Drop Down
Groupie
Groupie


Joined: 30 October 2007
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote DataFlowJoe Quote  Post ReplyReply Direct Link To This Post Posted: 17 April 2009 at 12:48pm
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)
Back to Top
dentor View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2005
Location: France
Status: Offline
Points: 102
Post Options Post Options   Thanks (0) Thanks(0)   Quote dentor Quote  Post ReplyReply Direct Link To This Post Posted: 19 April 2009 at 9:24am
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
Back to Top
DataFlowJoe View Drop Down
Groupie
Groupie


Joined: 30 October 2007
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote DataFlowJoe Quote  Post ReplyReply Direct Link To This Post Posted: 20 April 2009 at 1:40pm
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)
Back to Top
jgordon428 View Drop Down
Groupie
Groupie


Joined: 11 June 2009
Status: Offline
Points: 21
Post Options Post Options   Thanks (0) Thanks(0)   Quote jgordon428 Quote  Post ReplyReply Direct Link To This Post Posted: 12 April 2010 at 2:05pm
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.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.184 seconds.