SeedCodeCalendarPro

Integration

Overview

SeedCode Calendar Pro is designed to be linked with your own FileMaker file, swapping out our contact’s table for the one in your file.

The instructions which follow will show you how to swap out the contacts table which comes with SeedCode Calendar for a contacts table in your file. We’ll also change the contact selector layout so that you can use that to link contacts to appointments (and to select contacts when filtering the calendar by contact).

(Note that if you’d rather build out from SeedCode Calendar, adding the fields and layouts necessary for contacts etc. to this file, you may wan to check out SeedCode Complete, which includes a more complete contact manager: the contacts table included here just a placeholder for your own contacts. You can find out more about SeedCode Complete at http://www.seedcode.com/calendar)

A Note About Contacts and Companies

Your contacts table may very well have a different relationship between contacts and companies than we have here in SeedCode Calendar. So while the first part of this integration should be pretty much the same for all contacts files—linking a contact to an appointment—the details of getting things like the contact’s company name to show up will vary depending on how your file is set up. We’ll assume that you have a company name field in the contact’s record, as we do in our placeholder table. If you have something more elaborate, like a relationship between a contacts table and a company table, then you probably know how to adapt the company portion of these instructions as necessary.

Getting Started

A lot of the work you’ll be doing involves editing the relationship graph in SeedCode Calendar so that it looks the same as it does now, but the table occurrences point to your tables instead of ours. Accordingly, it can be a big help to print the relationship graph for reference. Of course you’ll want to have as backup of SeedCode Calendar for reference, but having a pdf of the relationship graph can be very handy as you can refer to it while you’re editing the graph.

You might also want to print the field definitions of the Appointments table and the Filter table, either to pdf or to paper. We’ll have to repair a number of calcs in these tables once we point our table occurrences at your files and this can be easier if you have a non-filemaker reference of what the calcs originally looked like.

Finally, print the definitions for the script: “Select Company/Contact ( Operation , Action ) { ContactID , CompanyOnly , Multiple Selection }”. This script looks complicated, but you’ll only be editing a portion of it.

Here We Go

1. Backup your files. Really.

2. File References. Begin by defining a file references in SeedCode Calendar for your contacts file.

Select File / Define / File References ( or in FM9 File / Manage / External data Sources...) and click “New” to create a new reference. Remember, its best to have your file in the same relative location to SeedCode Calendar that it will have on your server. Name the file references Contacts.

Next, since you’ll want to highlight your selected contacts just like we do in the pop-up selector window, create a file reference for SeedCode Calendar in your file and add a table occurrence for the “Filter” table to your graph: you don’t have to link this table occurrence to anything. Add an additional table occurrence for the “interface” table. You also need no links to this table occurrence.

3. Preparing your file. Your contact table will need a unique identifier: something like a serial number. This need to be a text field (we preface ours with a “C”, but t that isn’t necessary). In the rest of these instructions we’ll refer to this fields as your “ContactID”.

Your contacts table will also need a static field equal to one, you can use something like our ”_c_CommonOne” field.

You’ll also need to create a few other fields in your table, copying the definitions from the same fields in our contacts table. When you’re creating these, be sure to make each calculation return the correct type (number, text, etc.) Create the following fields:

z_ContactHighlightCalc Note that in your version of this calc you can replace ”Filter_SelectCoOrContact::...” with “Filter::...” since “Filter” is what you named your table occurrence in step 2 above. Replace our reference to ContactID_kprime with the name of your contact id field. And be sure to remove the /* and */ at the beginning and end of the field definition: FileMaker drops these in when there are things it doesn't recognize and you'll need to remove them in order for the calc to be evaluated. (This applies to the following field as well.)

z_ContactTypeAhead_kCalc If you have FileMaker Advanced, you can simply copy the custom function “SeedCode_TypeAheadKey” into your file before adding this field. If you can’t copy the function, you can use this calc instead of the one in z_ContactTypeAhead_kCalc instead:

left ( ContactNameLast ; 1 ) & ¶ &
left ( ContactNameLast ; 2 ) & ¶ &
left ( ContactNameLast ; 3 ) & ¶ &
left ( ContactNameLast ; 4 ) ¶ &
left ( ContactNameLast ; 5 ) & ¶ &
left ( ContactNameLast ; 6 ) & ¶ &
left ( ContactNameLast ; 7 ) & ¶ &
left ( ContactNameLast ; 8 ) & ¶ &
left ( ContactNameLast ; 9 ) & ¶ &
left ( ContactNameLast ; 10 ) & ¶ &
left ( ContactCompanyName ; 1 ) & ¶ &
left ( ContactCompanyName ; 2 ) & ¶ &
left ( ContactCompanyName ; 3 ) & ¶ & left ( ContactCompanyName ; 4 ) & ¶ &
left ( ContactCompanyName ; 5 ) & ¶ &
left ( ContactCompanyName ; 6 ) & ¶ &
left ( ContactCompanyName ; 7 ) & ¶ &
left ( ContactCompanyName ; 8 ) & ¶ &
left ( ContactCompanyName ; 9 ) & ¶ &
left ( ContactCompanyName ; 10 ) & ¶ &
ContactCompanyID_kf

4. Relationships. Now we’ll swap out the relatively simple relationships between an appointment and its related contact. Scroll down to the Daily section of the relationship graph and look for the green table occurrence (TO) named “Cal DailyAppointments”. To the right of this, and related to it, you’ll see the contacts occurrence named “CalDailyApptContacts”. Roll your cursor over the arrow in the upper left of this TO and you’ll see that its source is the Contacts table in the current file. We’re about to switch it to the contacts table in your file.

Note. In all that follows you’ll want to keep the names of the table occurrences as they are. This means you have to copy the table occurrence name before you point it at a new table, which renames it. You’ll then paste the original name back in. Copy the name “CalDailyApptContacts”.

So, double click on he relationship between CalDailyAppointments and CalDailyApptContacts; you’ll see this relationship is from ApptContactID_k to ContactID_kprime. We’ll need to line these fields up again once we re-point the TO. Click OK and now double click on the CalDailyContacts TO itself, copy the name, and switch the file designation at the top of the window from the current file to your file. Now select your contacts table, and then paste the original TO name (“CalDailyApptContacts”) back in.

Now double click on that relationship to CalDailyAppointments again and fix the right side to that it points to your ContactID.

You’ve just “re-pointed” your first table occurrence.

Continuing, you’ll see that there are a number of other instances of the contacts table on the graph and you’ll need to re-point all of them this way. At this point you’ll want to start at the top of the graph and re-point each instance of the contacts table, taking care to preserve the TO name and repairing the relationships in each case. Do not worry about the TOs in the Contacts section-- that section just governs our placeholder table and the layout depicting it on the Settings tab-- you’re replacing that layout with your own file. Rather, do the TOs in the “Select…” section, and the “Settings” section.

Here are the TOs you need to repoint:

Filter_SelectCoOrContact_ContactChosen
Filter_SelectCoOrContact_ContactSelected
Filter_SelectCoOrContact_Contact
AboutContactSelected

When you get to "Filter_SelectCoOrContact_Contact" you'll see a pair of relationship criteria using the field "z_ContactIsCompany_kCalc".This field is used in the relationship so that we can, in some cases, show just company records in the list of possible contacts to select from. The only time we do this is when we're using that selector to pick the company that a given contact should be linked to.

Presumably your contacts file already has the arrangement between contacts and companies worked out, so you shouldn't need to filter this selection to just companies. If that is the case, you can leave this field out of your file, and leave that pair of fields out of the Filter_SelectCoOrContact_Contact relationship (you can also remove the field FilterCompaniesOnlyGlob from the "Select Company / Contact" layout).

5. Field Definitions. There are a few fields in the appointments table that make use of contact information and you’ll want to edit these now. When you re-point TOs as we’ve done here, the fields used in calculations that reference these TOs often shift: here we’ll shift them back.

Take a look at your printed field definitions and adjust the following fields so that they use the proper fields from your file. For example, in the Filter table, and make sure the reference to the contact’s table in the “FilterContactDisplayCalc” references your contact name field. Here are the fields you need to check:

In Appointments:
ApptTitleDisplayCalc
In Filter:
FilterContactDisplayCalc

6. Editing Layouts. Just as in step 5, fields on layouts shift when we re-point table occurrences, so we need to visit the layouts which display appointment-contact information and shift the fields back. This is pretty simple, though you may have to unlock (from the arrange menu, select “unlock”) some objects in layout mode in order to edit them.

Begin on the Appointments tab of the Day view and double click on what used to be the contacts’ name field in the appointment record under the contact filter. This will be the wrong field (or no field) from your contacts table; simply point it at the correct field.

Next enter layout mode and scroll to the Mini Window Edit Appointment layout. There are a few more contact fields here: shift these back to the correct fields as you did the ones on the daily view. Note that we chose to show the contact’s phone number and company affiliation here. You can choose to show any contact information that is either in the contacts table or in any TO related to the CalDailyApptContacts table occurrence. So, if you have related Company or phone numbers in separate tables in your file, add TOs for them off of CalDailyApptContacts so you can have access to fields from those related tables here.

The fields you’ve just repaired are also present in exactly the same format on the “Mini Window Show Repetitions” layout. You may want to copy the repaired fields you just did and paste them there.

You’ll also need to shift fields on the “Select Company / Contact” layout. Note that the portal on this layout has the z_ContactHighlightCalc field behind the other fields, make sure you shift this field to the instance of z_ContactHighlightCalc in your file.

Finally, you'll repoint the contact's name field on the Appointment List and Appointment Table layouts.

7. Scripts. Enter layout mode and navigate to the Mini Window Edit Appointment layout. Click on the More tab and you’ll a green button that should take you to the contact linked to a given appointment. The button here calls the “Edit Appointment – Show Contact” script. Edit that script, deleting all the steps replacing them with this:

Set Variable [ $$Window; Value:Get ( WindowName ) ]
If [ not IsEmpty ( CalDailyApptContacts::ContactID ) ]
Go to Related Record [ From table: “CalDailyApptContacts”; External; Using layout: “Contacts” (Contacts) ]
Perform Script [ “Arrive” from file: “Contacts” ]
Close Window [ Name: $$Window ]
Select Window [ Name: “Contacts” ]
Halt Script
End If

Note that you can specify which layout in your file to use in the Go To Related Record step. Also be sure to uncheck “this file only” in the “Select Window” step: that window name you select should be the name of the window in your file—most likely the name of your other file minus the .fp7.

Finally, the Perform Script above would call any script you may need to manage your “arrival” at the other file. You many not need such a script and could then remove this step.

Next, edit the script “Select Company/Contact ( Operation , Action ) { ContactID , CompanyOnly , Multiple Selection }”. Refer to your printed copy to shift a few fields back to the equivalent fields in your file. Here are the instances you need to shift:

The first SetField after “Pre Filter. Incl CompanyOnly”
In the Select section, a couple of the SetFields, including those within the If [ $$ContactMultipleSelection ≠ “Yes”

8. Select Contacts. Enter layout mode and scroll to the “Select Company / Contact” layout. Remove the “New” button from this layout. This is the one feature that doesn’t really translate easily to a new file—adding a new contact while selecting one. Experienced developers can add an equivalent function as they see fit.

9. Testing. At this point you can test your work. You should be able to link a contact with an appointment and filter the calendar by contact. If you have problems, check the relationships in the relevant areas against a unmodified copy of this file to make sure you have the relationships right. And of course, if you just can’t get it working, give us a call.

Showing Contact Activity in Your File.

The next logical step here is to show a portal of contact activity in your file. So that you can see all the appointments and comments for a contact without jumping to the calendar.

To to this, you’ll add a number of table occurrences to the graph in your file; you’re basically going to mirror the contact activity section of the graph in SeedCode Calendar.

You’ll then link the ContactActivity TO in the activity section of the graph with your contact table occurrence by ContactID to ApptContactID_kf. Once you’ve added these TOs to your graph, and named them exactly as they are named in the SeedCode file, you can copy the whole ContactActivity portal from the Contacts layout in SeedCode Calendar and paste it into your contact file. If you’ve named your TOs the same as ours, all the objects on this pasted layout will resolve with the exception of the filters. Rather than try and move our filter logic into your file, we’d suggest removing the filters or simply creating your own, simpler filters, taking ours as a model.

If you want to be able to create new activity from your file, you can call the “New Appointment from External { Date, Time, ContactID }” script in SeedCode Calendar from your file. While none of the script’s possible parameters are required, you may pass a Date, Time, or Contact to the script in the following format:

“Date = SomeDate ; ContactID = “ & YourFile::YourContactID

That’s it!

(855) SEEDCODE
[email protected]
Follow us: