SeedCodeCalendarComplete

Integration

Overview

While many people will choose to build out from SeedCodeComplete, adding the fields and layouts necessary for their contacts and projects, some people may find it useful to point the calendar component of this solution at their own contact or project files.

The instructions which follow will show you how to swap out the contact and project tables which come with SeedCodeComplete for tables you may already have. This will make the Contacts and Projects tabs of this solution useless (you wouldn't be swapping out these tables unless you had contact and project layouts that worked better for you), though we'll keep the contact and project selector layouts working so that you can still use those to link contacts and projects to appointments.

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 SeedCodeComplete. 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 some kind of relationship between contacts and companies. If you don't, but rather just have a company name field in the contact's record, well then most of this company specific stuff can be ignored.

Getting Started

A lot of the work you'll be doing involves editing the relationship graph in SeedCode Contacts 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 a backup of SeedCodeComplete 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 two scripts: "Select Company/Contact ( Operation , Action ) { ContactID , CompanyOnly , Multiple Selection }" and "Select Project ( Operation , Action ) { ProjectID , ContactID , Multiple Selection }". These scripts look complicated, but you'll only be editing a portion of them.

Calendar

1. Backup your files. Really.

2. File References. Begin by defining file references in SeedCodeComplete for your contacts and projects files. (If these are different tables within the same file, you'll only need one file reference.)

Select File / Define / File References and click "New" to create a new reference. Remember, its best to have these files in the same relative location to SeedCodeComplete that they'll have on your server.

We'll assume you have a separate contacts and projects file, so name the file references Contacts and Projects respectively.

Next, since you'll want to highlight your selected contacts and projects just like we do in the pop-up selector windows, create a file reference for SeedCodeComplete in your file(s) and add a table occurrence for the "Filter" table to your graph(s): 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 files. Your contact and project tables will each need a unique identifier: something like a serial number. These need to be text fields (we preface ours with a "C" and a "P", but that isn't necessary). In the rest of these instructions we'll refer to these fields as your "ContactID" and your "ProjectID".

Each 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 each table, copying the definitions from the same fields in our contacts and projects tables. When you're creating these, be sure to make each calculation return the correct type (number, text, etc.) Create the following fields:

Projects:
ProjectActive
z_ProjectActive_kCalc
z_ProjectCompanyAndContact_kCalc Note that this field uses ProjectCompanyID_kf. This field represents the ID of the company related to this project. We assume you have such a field relating your companies (or your contacts) and projects. If you only have one field here (you relate projects to contacts +or+ companies but not both) you can remove one of the fields, but be sure you keep the carriage return and dash at the end of the calc.
z_ProjectHighlightCalc In place of "Filter_SelectProject::" use "Filter::" in this calc.
Contacts:
z_ContactHighlightCalc
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 version 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. Now we'll swap out the relatively simple relationships between an appointment and its related contact. Scroll down to the Daily View 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.

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. 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 ("CalDailyContacts") 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 a relationship from this newly re-pointed TO off to "CalDailyApptContactsCompany" on the right. We use this relationship to show the company name of the contact associated with an appointment. If your company name is _in_ your contacts table, you can leave this TO alone for now. If you have a relationship between contacts and companies, you'll want to re-point this TO much as we did the previous one, selecting your company table as appropriate and linking it to CalDailyApptContacts in the same we you link contacts and companies in your file: however that may be.

Working in this same area of the graph, you'll take the instructions we applied above to CalDailyApptContacts, and apply them to CalDailyApptProjects.

There are a number of other instances of the contacts table on the graph and you'll need to re-point almost all of them this way. I say "almost" because many of these instances manage the relationship between a contact and a company. These company relationships are to the right of the contact relationships just as "CalDailyApptContactsCompany" was in the example above.

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 or Projects sections- you're replacing those layouts with your own file. Rather, do the TOs in the "Select..." sections, the "Settings" section and the "Daily Views" and "Gantt" sections.

Note that off to the right of many of the Contact and Project based table occurrences you'll find other TOs like "Filter_SelectCoOrContact_ContactChosenCompany" and "AboutProjectSelectedPhases". Your database may not have anything that corresponds to these TOs. So if you don't have a separate companies file, or a way to related projects to phases, you can just delete these extraneous table occurrences- or preface their names with an X so you can delete them later.

When you get to the "Filter_SelectCoOrContact_Contact" TO 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 and/or project 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:

Appointments:
ApptProjectDisplayCalc
ApptTitleDisplayCalc
Filter:
FilterContactDisplayCalc
FilterProjectDisplayCalc

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 Daily view and double click on what used to be the contacts' name field under the contact filter. This will be the wrong field (or no field) from your contacts table; simply point it at the correct field. Do the same with the project name field to the right of it. Don't worry about the filters for now, we'll get to them in a subsequent step.

Next enter layout mode and scroll to the Mini Window Edit Appointment layout. There are a few more contact and project fields here on the "more" tab. 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._

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 and the "Select Project' layout. Note that the portals on these layouts have the z_ContactHighlightCalc (or z_ProjectHighlightCalc) field behind the other fields, make sure you shift this field to the instance of z_ContactHighlightCalc or z_ProjectHighlightCalc in your file.

You don't have to edit any of the actual Contact or Project layouts since you won't be using those any more: you'll be using the ones in your file.

When it comes to the "Edit Company / Contact" and "Edit Project" layouts, you'll likely want to paste in sections of the contact and projects layouts from your file. To make this easier, create new table occurrences in SeedCode Calendar for your contact and project tables using _the same names_ as the table occurrences on which your main contact and project layouts are based. Change the "Edit Company / Contact" and "Edit Project" layouts to be based on these new table occurrences and then you can simply paste layout objects from your files right here.

7. Scripts. Enter layout mode and navigate to the Mini Window Edit Appointment layout. Click on the More tab and you'll see two green buttons which should take you to the contact or project linked to a given appointment. The contact 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.

You'd similarly change the "Edit Appointment - Show Project" script, replacing it as follows:

Set Variable [ $$Window; Value:Get ( WindowName ) ]

If [ not IsEmpty ( CalDailyApptProject::ProjectID ) ] Go to Related Record [ From table: “CalDailyApptProjects”; External; Using layout: “Projects” (Projects) ] Perform Script [ “Arrive” from file: “Projects” ] Close Window [ Name: $$Window ] Select Window [ Name: "Projects" ] Halt Script End If

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:

In the Begin section, the SetField after If [ $$CompanyOnly = 1
The first SetField after "Pre Filter. Incl CompanyOnly"
In the Select section, both the SetFields within the If [ $$ContactMultipleSelection ≠ "Yes"

The script "Select Project ( Operation , Action ) { ProjectID , ContactID , Multiple Selection }" is completely parallel to this, so make the equivalent changes in that script.

8. Select Contacts & Projects

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.

Remove the "New" button from the "Select Project" layout also.

9. 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. You should also be able to link a project and filter the calendar by project. 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 & Project 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 or project 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 SeedCodeComplete...

You'll then link the ContactActivity TO shown above with our 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 above, you can copy the whole ContactActivity portal from the Contacts layout in SeedCodeComplete 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 , ProjectID, Class }" script in SeedCodeComplete from your file. While none of this scripts possible paramaters are required, you may pass a Date, Time, Contact, Project, or Class to this script in the following format:

"Date = SomeDate ; ContactID = SomeContactID ; ProjectID = SomeProjectID ; Class = calendar"

Project Activity

Much as you did with contact activity you'll mimic the project activity section of our graph in yours, naming the TOs the same as ours before pasting the Project Activity portal from our file into yours.

That's it!

(855) SEEDCODE
[email protected]
Follow us: