Integration
How Can I Use My Own Appointments File in the Calendar?
Swapping Out the Appointments Table.
In many cases, it will be easier to simply modify the appointments table that comes with SeedCodeCalendar. However, if you have a complex appointments file that already has a lot of work in it, you may wish to point SeedCodeCalendar at that file instead. To do this you’ll accomplish a couple basic tasks. First, you’ll define a file reference for the file containing your appointments file and add the key calculation fields from our appointments table to the table in your file. Then, you’ll point SeedCodeCalendar at your file by editing the calendar's File References, and Relationships. Lastly, you’ll tidy up a few things by reviewing a few layouts and scripts in SeedCodeCalendar.
Experienced FileMaker developers will be able to do this pretty quickly by simply looking at the Relationship Graph for this file and the field definitions for the appointments table. Even so, the checklist below might be of help.
1. Backup your files. In addition to making a backup copy of your file, we suggest you print all calendar scripts to a PDF that you can refer back to while you're working. Printing the Relationship Graph and Field Definitions as PDFs is also prudent. While you'll have the original files as backup, it is easier to refer to PDFs while you're working.
2. Prepare your Appointments Fields. You'll need to make sure that you appointments file has a few basic fields used to relate appointments to the calendar. Note that you're fields don't have to be named the same as ours, but it can helpful to use the same names as all our documentation (and the Q & A on our support forums) refer to these field names. Even if you don't keep these names long term, using them for the duration of this modification seems like a good idea. You'll need at least the following fields in your appointments file:
These last two time fields aren’t actually required for the calendar to function, but the start time is used in some of our sorts (for instance when we sort the portal of appointments on the Daily tab). If your appointments don’t have times and you don’t need a time field, no problem: just remember that when it comes to sorting your appointments you’ll only have one sort criteria (the date) not two (the date and time).
3. Create a File Reference for Appointments. To point the calendar at your appointments table, you'll add a file reference for your appointments table in our calendar ; to keep it simple, name the file reference “AppointmentsNew” for now. Go to File / Manage / File Reference. Click “New” and then click the “add file“ button to add a line for your appointments file. Note: Do not rename the table occurrences in the calendar. The names of our existing table occurrences are frequently used in scripts.
4. Repoint the Daily Relationship on the Graph in SeedCodeCalendar.fp7. Select File / Manage / Database from the File menu and select "Relationships" so that you can see the relationships graph. All of the Green table occurrences (TOs) in this graph refer to the Appointments table; currently each of these TOs points to the original appointments table in SeedCodeCalendar. We'll need to change each of these to point to the appointments table in your file. When we do so, the relationships between these TOs will break and we'll need to fix them. Fortunately, this isn't as hard as it sounds.
Lets tackle the first one, the "Appointments" TO in the "Table Listing" section of the graph. This is up towards the top under the label “Data Tables”. Double click on this TO and you'll see the "Specify Table" dialog window. Note that the TO is currently from the "Appointments" table and that it is from the "Current File.." (You can see the file attribute in the pop up list to the right of the word "File:" near the top of this dialog.) It is important that as we repoint these TOs that we don't rename them. This one is currently called "Appointments" and we'll want to paste that name back in there after we point this at another table. From the "File:" pop up, select your appointments file. You'll now see a list of the tables in your file. Select your appointments table and then change the name of the TO so it continues to read "Appointments." Click "OK" to close the dialog. You've just "repointed" a table occurrence (TO).
Do the same thing for the next green TO on the graph, CalDailyAppointments in the Daily View section. Point this at the appointments table from your file, making sure to keep the name CalDailyAppointments. When that’s done you'll notice that your newly repointed TO is now no longer properly related to "CalendarDaily". To fix this, double click on the relationship line connecting these TOs. Edit the right side of this relationship so that...
...then click OK. At this point you’ve not only re-pointed the TO, you’ve repointed the relationship as well. Lining the fields back up so that they now match the corresponding fields in your table. You're going to follow this procedure for each Green TO on the graph. Each section of the graph has its own flavor and instructions for specific sections follow.
5. Re-Point Month & Week Relationships. Select File / Manage / Database from the File menu and select "Relationships" so that you can see the relationships graph. You'll want to edit all the relationships between CalendarMonth (in blue) and the Appointments (in Green) TOs to the right of it and below it. There are 8 of these all together and all but one follow the same basic format. Lets look at the first one: check out the relationship between CalendarMonth (in blue) and CalMonthAppointments01 (in Green). This is in the "Month & Week Views" section. Copy the name of the TO (CalMonthAppointments01) so you can keep than name and point the TO at your appointments table just as you did with the Daily occurrence above, renaming the TO “CalMonthAppointments01” when you’re done. Double click on the "=" between these table occurrences to edit the relationship. In each case, you’ll want to make sure that the right hand side of this relationship uses “ApptDate”. The left hand side won’t require any editing.
You'll need to do this for each of the 7 green TOs to the right of CalendarMonth.
The last green TO has a slightly different relationship criteria containing two parameters instead of one. Both of these relationship parameters line up with “ApptDate” on the right so you can repoint this last TO as you’ve done the others.
6. Edit Layouts. The fields in your appointment table likely don't line up with the fields in our appointments table, so once your new relationships resolve, you'll need to edit the calendar layouts to make sure the correct fields show up in the correct places. Go through each layout in the calendar and double click on each appointment related field to check that it is displaying the correct field.
Just a few notes about some of these layouts:
7. Edit Scripts. While you don't need to create any scripts in your appointments file, you do need to edit a few scripts in our calendar that set specific fields in the appointments table. As with layouts, your fields may not line up exactly with the original fields. Check the following scripts in SeedCodeCalendar: these scripts are thoroughly commented to make this process easier. However there are too many references to appointments to reproduce them all here: below you'll see a list of the places to check in each script. Look at your PDFs of the original scripts to make sure you select the correct field:
8. That's It!