06. Repeating Events [17:27]

Description: This video provides an overview of how to handle repeating events in FileMaker and iCal using the iCal Manipulator.

Transcript:

Hi, in this video we are going to take a closer look at working with repeating events. Please note that in this video and throughout our demo we sometimes refer to a repeating event as an event having a recurrence or recurrence rules. We use these terms interchangeably.

0:18 Let’s take a look at the demo itself and how we’ve constructed it to work with repeating events or recurring events. First we create an event record in the demo. This you’ve already learned on a previous video. And once we create that event record we immediately add that to iCal. Let’s do this now and get it set up. I have here my iCal calendar; in fact I have two calendars: a home and a work showing April 2010. Currently I have no events. Let’s open up the demo file. We will assume that you’ve already registered the plug-in. Let’s bring in calendars; ok now we have a work calendar and a home calendar. And let’s create an event. First let’s define our filter; let’s work with the work calendar and we’ll do a date range of this year that way we can capture events after we’ve added them and import recurring items. We’ll see that in a minute.

1:19 Let’s create a new FileMaker record and prepare an event for iCal. Again we will use the work calendar, say My Test Event (with repeat). Alright, let’s make this not an all day event, let’s put April 1st at 8:00am and through April 1st at 9:00am. Ok, we’ve got a note, a location and now we are ready to add that to iCal. So we will just click this button here and add it to iCal; it’s returned an ID; let’s go check that out. Sure enough there is my event in iCal. Alright, so we’ve added the event in iCal, we have our event record and now it’s time in the demo to create a recurrence record. We’ll actually create another record in FileMaker that stores the Recurrence Rules for that event. After we define the rules in FileMaker, we’ll push those rules to the event in iCal. So it’s going to look up the existing event and say we now want to repeat this event. And if we specify for example to repeat twice or repeat a total of three times iCal will automatically take those rules and create new events in iCal base on those rules. Now that we have essentially three events in iCal we’ll re-import those back into the demo so that you can see we now have records in FileMaker matching the corresponding records in iCal.

3:05 So a little bit about the Recurrence Rules themselves. iCal gives you several options and they work similar though. You can repeat everyday, every week, every month, and every year, there’s even an option for custom. So if we were to repeat everyday for example, we would then have the option of choosing when to end that repeat. You can choose never, after, x amount of recurrences. For instance if I were to put a 3 in there it will repeat a total of 3 times. Or I can choose to end on a certain date. So essentially the day, week, month and year types all give you the same end types: Never, After and On date. The only time this gets a little tricky is when you choose custom, which we will talk about a little later. Let’s go take a look at the demo and start playing around with the fence.

4:00 So just like we saw, we are going to create a repeating option here or a repeat record in FileMaker. Now I’ve got a record and we are going to define the recurrence rules or the repeating rules. I’ll specify a type; you can see her I have daily, weekly, monthly or yearly, let’s choose daily. We also get the option of recurrence interval. Right now it’s set to 1, but if I set this to two it will repeat every two days versus every one day. If I set this to 6, it will repeat every 6 days. For now let’s keep this easy and repeat everyday. Then like we learned earlier, we have to choose when to end that repeat. In this case let’s just say we are going to end on April 3rd. Now please note a very important aspect to ending on a certain date. iCal expects the time 11:59:59. If you specify any other time than that it will actually make your end date one day sooner. So instead of the 3rd in this case, if I put like 4/3/2010 and I put my time at 10:00pm, because it’s not a full day it will actually end the event on the 2nd of April instead of the 3rd. So you actually have to specify 11:59:59, that’s a very important aspect. Let’s go ahead and update that rule and you can see that in fact we now have 3 events repeating through the 3rd. Let’s go check iCal, and sure enough the same goes there. If I take a closer look you can see that the demo specified the exact time to repeat through. Just like we added a recurrence option, we can remove it just as easily. I can click here and remove the rule in iCal. That will open up the event and remove the fact that that event repeats. Back to iCal and you can see I’ve got a regular non repeating event. Let’s look at another option of repeating. This time I’ll pick daily, but instead of picking a certain end date, I’ll say 5 occurrences. Now you can see that the event repeats 5 times or after 5 times. Total of 5 events, there we go.

6:43 Alright, now let’s take a look at some other options for repeating. Let’s go ahead and remove that rule and let’s create another one. This time we will pick weekly with an interval of 2 which is every two weeks. And let’s pick after 5 times there. Update that rule. You can see we still have 5 actual events but they should be repeating every other week. Let’s go check iCal, and sure enough I have 1, 2, 3, 4, 5, so I got a total of 5 repeating events every other week. No that’s repeating options in its simplest forms. But it can get very complex very quickly, especially when you talk about custom options. Let’s go add one of those now. Let’s for instance say I wanted to repeat every week and I wanted to specify day of the week to repeat. Let’s again pick 5 times and then we will click the advanced view. Here I can choose 2, 3 and 4. So I essentially picked a custom option where I want it to repeat every week on Monday, Tuesday and Wednesday. And when I do that it prepares the rules in such a way iCal will behave properly. Let’s go take a look. Let’s go take a look at this custom option here. So it has selected custom every week on Monday, Tuesday and Wednesday after 5 times. Now I’m not going to be repeating a total of 5 weeks because it’s a number of recurrences not number of weeks. So Monday, Tuesday, Wednesday there’s my three, 4, 5 for the remainder of the series. So you can see here we’ve set up a very complex repeat option from the demo using the advanced button within the demo repeat options.

9:24 Now a good way to experiment with this is to actually create a complex scenario in iCal. Then import that event into the demo. There you can see all the nuances of how that works. So let’s go do that now. Let’s first delete this event and we will delete all the repeating options for that event. Now let’s create a new event on the 11th of April. Ok, now let’s go to month view and let’s give this event a fairly complex repeat scenario. Let’s choose custom, let’s choose monthly, and we’ll say every two months on the 11th and the 24th. Ok, now iCal has rendered that for the 11th and the 24th every two months, there’s June, there’s August, there’s October the 11th and 24th. This would be considered a fairly complex repeat scenario. And I believe I also gave it an end date of never. So again a great way to experiment is simple import the events for this year, I’ll do that now, and you can see here I have my repeats for the duration of the date range that I found for which is this year. And if we take a closer look at the first one of those and look under the hood and click on the advanced view, you can see how FileMaker has received those fields and the criteria. You can see that the days of the month represent 11 and 24 and you can see that Has End has false so it has no end date, you can see that it uses no end date which is also false and the recurrence type is monthly. So this is how this would be set up.

11:42 Let’s go take a look at another advanced option. Back to iCal. We’ll delete all those and this time we will create an event on the 7th and we’ll do another custom repeat. This time we’ll do weekly every 4 weeks on Monday, Wednesday, Friday and we’ll say end after 115 times. So we have Monday, Wednesday and Friday every 4 weeks. You can see that playing out there. Let’s go into the demo and import all events for this year. You can see that our events came through nicely. Now we only have 29 records here because that’s all that represents for the given year. So if I made my date range wider than I would probably see all the events. You can see we are spanning well into 2011, 2012 based on my criteria. So back to the demo here, let’s take a look under the hood, and go to the advanced view. So we can see here in this case the days of the week are represented as a list of 2, 4 and 6; notice there is a return here between these values; has an end – True, this time it does have an end point. It has a recurrence count of 115, interval of 4 for every 4 weeks, the type is weekly, but it doesn’t have an end date, a specific end date so that’s False. So this is how you construct a complex event repeat option.

13:43 Finally let’s go look at the script itself to see how we’re adding events. So the best way to do that is to add an Update Recurrence Rule in iCal. This is the script that does that. So we set up some preliminary things: we show a splash screen, and here’s a key point. We first have to open the event before we can even begin to add a recurrence to it. So we are saying here, open the event, the type of event with the UID. And we are using the word RECURRENCE here because that’s were we store the ID when we create the recurrence event. So essentially we open the existing event and we remove any recurrences that may have already existed for that event. It’s just a way of cleaning up the record. So we open up the event, we remove all recurrences and then we save that. Now we’ve saved the event essentially as a non-recurring event. Then we specify the actual occurrence parameters. And you can see here it’s expecting the type followed by the interval, the days of the week, the days of the month, and week days of the month, month of the year, end date and the occurrence count. And you can also refer to the documentation on how each of those works. Like we said earlier we are going to add a recurrence using the PCIM_AddRecurrence command, and then were going to save the record. And the moment we save the record the occurrence rules have taken place in iCal and the rest of this here is just re-importing, closing the window and re-importing the events into the demo to see that we actually have multiple records now. So that is how to add a recurrence.

15:38 Let’s talk about how we import recurrence rules. So in this part of the script we import the recurrence rules when we actually click; let me show you here; this button. The moment we click this button is the moment we open that event and bring in any recurrence rules for it. So now let’s take a look at that script. So right here we are saying is it a repeating event, yes it is. Go to the recurrence rule, find an existing FileMaker record if we’ve already created it earlier. If not, create a new record. And then begin to import all the recurrence information for that event. Now keep in mind that this is a sub-script indicated by this under score here in our demo. This sub-script is called after the event has already been opened. Now we’ve go that and we’re simply setting fields in the demo with the criteria here. So we are getting the property for the recurrence rule and we are specifying the type. In this case it’s the recurrence type, interval, days of the week, month and so on. So we’re populating the demo with all of that information. Here’s another little bit of logic that if the recurrence has and end date of true, also bring in the recurrence end date or the recurrence end count and so forth. Then we in the demo we simply do a little clean up to make sure that we’ve deleted any other related recurrence events in FileMaker.