CCCalendar

Integration Pro

Full and Pro Versions: How can I use my own Appointments file in the Calendar?

Applicable Versions: Full and Pro.

Swapping out a New Appointments table: Full and Pro Versions

In many cases, it will be easier to simply modify the appointments table that comes with CC Calendar. However, if you have a complex appointments file that already has a lot of work in it, you may wish to point CC Calendar at that file instead. To do this you’ll accomplish a couple basic tasks. First, you’ll define a file referennce for the file containing your appointments file and add the calculation fields, from our appointments table to the table to your file. Then, you’ll point CC Calendar at your file by editing its File References, and Relationships. Lastly, you’ll tidy up a few things by reviewing a few layouts and scripts in CC Calendar.

Experienced FileMaker developers will be able to do this pretty quickly by simply looking at the Relationship Graph for CCCalendar.fp7 and the field definitions for the appointmens table. Even so, the checklist below might be of help.

1. Backup your files. Also, if you're working with the Pro Version you'll be editing some complicated scripts when it comes to re-pointing the repeating events script. Before you get started we suggest you print all CCCalendar.fp7 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 File. 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 help to use the same names as all our documentation (and the Q & A on our support forums) refer to these field names. You'll need at least the following fields in your appointments file:

ApptDateStart - the date your appointment begins.
ApptEndDate - the date your appointment ends.
ApptDateEndCalc - this calc is used to fill in an End Date for you appointments if one does not exist. If your appointments never last more than 1 day, you can edit this calc to simply use the StartDate of the appointment, or dispense with this field and use ApptDateStart in its place in calendar relationships. Note, the as the calc is presently written creates and end date for appointments that cross midnight. Again, if your appointments never cross midnight, you can simplify or dispense with this calc and with ApptEndDate.
ApptKeyDateRangeCalc - this is a complicated calc but with FM7’s great let function you can almost just paste this into your file. Simply replace the two fields in the let statement with your versions of “ApptDateStart” and “ApptDateEndCalc”. The only part of this calc that you’ll edit is the beginning...
Let ( [

Start = ApptDateStart ; End = ApptDateEndCalc ];

ApptUser - To keep CC Calendar simple, we relate appointments to people based on the person's initials. Formatting your data entry for a users' initials as a checkbox easily lets you record multiple users per appointment, which CC Calendar supports.
ApptKeyUserCalc - This calculation simply adds a "-" to the end of your list of users' initials for a given appointment.
ApptType (Pro Only) - Like ApptUser, this is a filtering key used to break up appointments into different types or different "calendars."
ApptKeyTypeCalc (Pro Only) - This calculation simply adds a "-" to the end of your list of Types for a given appointment. Though the interface of CC Calendar doesn't explicitly allow it, you could assign more than 1 type to an appointment, though the appointment would take the color of the first type assigned.
ApptTimeStart (Pro Only) - The start time of your appointment.
ApptTimeEnd (Pro Only) - The end time of your appointment.
ApptDateEndCalc (Pro Only) - this calc is used to fill in an End Time for you appointments if one does not exist.
ApptKeyTimeRangeCalc (Pro Only) - Like ApptKeyDateRangeCalc, this is a tough calc for which you only need to edit the Let statement:
Let ( [

MinuteStart = (GetAsNumber ( ApptDateStart )-1) 24 60 + Int(GetAsNumber ( ApptTimeStart )/60) ; MinuteEnd = (GetAsNumber ( ApptDateEndCalc )-1) 24 60 + Int(GetAsNumber ( ApptTimeEndCalc )/60) ];

ApptKeyRepeatIDX (Pro Only) - Used to link a repeating appointment to its parent.
ApptRepeatHighlightCalc (Pro Only) - This calc displays the green highlight on a selected appointment in the small list of repeating events which displays after repeating events are created. This requires a file reference in your appointments file and two Table Occurrences described in the next step. Perform step 3.1 below before returning to define ApptRepeatHighlightCalc.

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; to keep it simple, name the file reference “Appointments” for now. Go to File / Define / 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 CCCalendar.fp7

3.1 Adding a File Reference to Your Appointments File (Pro Only). The repeating events? feature requires a few items be added to your appointments file. Aside from ApptKeyRepeatIDX mentioned above these are really cosmetic but they make working with repeating events easier. Define a file reference for CCCalendar.fp7 in your appointments file, calling it "CCCalendar". Then place two table occurrences on the relationship graph in your file (you don't need any relationships to these TOs, just place them on the graph).

From the table "Calendar" create a TO called "CalendarGlobals";

From the table "Interface", create a TO called "Interface Globals".

Now return to step 2 above and define the field ApptRepeatHighlightCalc.

4. Re-Point Relationships on the Graph in CCCalendar.fp7. Select File / Define / 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 the Calendar (in blue) and Appointments (in Green) file. There are a lot of these, but they all follow the same basic format. Lets look at the first one: check out the relationship between Calendar Daily (in blue) and Appointments Daily (in Green). This is in the "Daily Views" section. Double click on the "X" between these table occurrences to edit the relationship. You'll want to select each line where there is an "unknown" field and select the correct field in your appointments table. While your fields may have different names, the relationship definition should look like this:

CalDateKey0 = ApptKeyDateRangeCalc

AND CalLinkUserCalc = ApptKeyUserCalc AND CalLinkUserHideCalc <> ApptKeyUserCalc AND CalLinkTypeCalc = ApptKeyTypeCalc (Pro Only) AND CalLinkTypeHideCalc <> ApptKeyTypeCalc (Pro Only)

You'll need to do this for every green Table Occurrence in the graph. Fortunately, the left hand sides of these will all be fine, but you'll need to re-point the right sides. Be careful and take your time.

4.1 Hour Relationships (Pro Only). The hour relationships (used for Time Display) in the Daily and Weekly sections use Date/Time fields instead of Date fields, so hour relationships look like this:

HourKeyTimeRangeCalc0 = ApptKeyTimeRangeCalc

AND CalLinkUserCalc = ApptKeyUserCalc AND CalLinkUserHideCalc <> ApptKeyUserCalc AND CalLinkTypeCalc = ApptKeyTypeCalc AND CalLinkTypeHideCalc <> ApptKeyTypeCalc

5. Edit the Layouts. Your fields likely don't line up with the fields in our apointments 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. Be sure to edit fields on each of the following layouts: Daily, Week. Month, Search, Mini Window Edit Appointments, and MiniWindow Show Repetitions (Pro Only).

6. Edit Scripts. While you don't need to create any scripts in your appointments file, you do need to edit a few scripts in CC 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 CCCalendar (these scripts are thoroughly commented to make this process easier):

New Appointment: Check the two set field statements. They should set your versions of ApptKeyDateStart, ApptUser, and ApptType (Pro Only) respectively. The script should end with a GotoField step going to your ApptTimeStart field.
Edit Appointment: Just check that the last line uses a GotoField step going to your ApptTitle field.
Edit Appointment - Nudge Date: Check the set fiels to make sure we’re manipulating your appointments start and end dates.
Create Repetitions (Pro Only): This is a tough script, but little of the difficulty involves creating appointment records so editing it is not too bad. Please print this script to a PDF and search for the word "Appointment", you can then find each instance and make sure it uses the proper field from your new appointments table.
7. Field Definitions. A few fields in CCCalendar.fp7 look for specific appointment attributes. All of these look for the Serial Number in the Appointments file: PrimeApptIDX. You'll need to review these definitions and make sure they're looking at the right field in Appointments:
CalDisplayMoreAppointmentsCalc 1 -7 looks for AppointmentsMoWk1:: PrimeApptIDX

8. That's It!

(855) SEEDCODE
[email protected]
Follow us: