Linking the Calendar to Your Own File
Who is this Quick Integration designed for.
This quick version is for folks who want to keep the calendar as a separate file-- as a second .fmp12 in their solution. This can be a great option if you need to get up and running right away, are newer to FileMaker, or want to see the calendar in a new window anyway.
If you want to embed the calendar within your solution, follow these instructions for pasting the calendar layouts and scripts into your file.
Before you get to work, you can watch a short video of the entire integration being done: it takes just 10 minutes... Quick Integration Video.
Step-by-Step Instructions: Linking the Calendar.
1. Getting ready.
Back up your file. Really.
Now move SeedCodeCalendar.fmp12 into the same folder as the file you'll be working with. If you'd like to rename the calendar file, do that now as well.
These instructions assume you already have a table whose records you want to see in the calendar. If you don't, you can just paste our SampleEvents table into your file and skip step 2 below.
You may also have more than one table (or more than one date field in a table) that you want to see in the calendar. Don't worry about that for now: get one table/field up and running and then you can come back and configure additional event sources
2. Field Definitions.
Open up SeedCodeCalendar.fmp12 and select File / Manage / Database, selecting the "Fields" tab of the "Manage Database" window and select the "SampleEvents" table. You'll copy a couple fields from here and add them to your file. If you have FileMaker Advanced this is as simple as copying these two fields...
...and pasting them into your file. Once they are there, edit the definition for each, removing the leading and trailing "comment" tags (the /* and */), and selecting your
fields for the DateStart, TimeStart etc. fields used in the calculation's let statements.
It may be that you don't have an end date field in your solution. You may also lack the time fields mentioned in the next steps (start and end times). The simplest thing is to add these fields to your events table: that makes the integration simpler and lets you take advantage of multi-day events should the scope of your events change. (Note that if you want to enforce that events never have times or never span more than 1 day you can use auto-enter calcs in these newly created fields to force them to be blank.)
If you create new fields, make sure the date fields are of the type "date" and the time fields are "time".
If you don't have FileMaker advanced, copy the definitions of these fields, carefully recreating them in your file. Make sure both calcs are of the type "number".
Next, add the following Auto-Enter Calculated Value option to the TimeStart field in your events table (you can copy this here or from the definition in SampleEvents):
Self = Time ( 24 ; 0 ; 0 ) ; Time ( 24 ; 0 ; 1 ) ;
Self = Time ( 0 ; 0 ; 0 ) ; Time ( 0 ; 0 ; 1 ) ;
Self > Time ( 24 ; 0 ; 0 ) ; Self - Time ( 24 ; 0 ; 0 ) + 1 ;
Make sure you uncheck
the "Do not replace existing value" checkbox. This Auto-Enter option is needed if you want events to be able to start at midnight.
Now add the same Auto-Enter Calculated Value option to the TimeEnd field in your events table. Again, make sure you uncheck
the "Do not replace existing value" checkbox. This Auto-Enter option is needed if you want events to be able to end at midnight.
If you plan to use the calendar's gantt charts, repeating events, or email notifications add a few more fields from our SampleEvents to yours:
3. The Relationship Graph.
Return to SeedCodeCalendar.fmp12 and again select File / Manage / Database, selecting the "Relationships" tab of the Manage Database window.
Double click on the "SampleEvents" table occurrence in the graph and click in the pop-up list next to "Data Source:"-- select "Add FileMaker Data Source" from the list of options and, in the next window, select your file.
You'll now see all the tables in your file: select the one which has the records you'd like to see in the calendar. Change the name at the bottom of the "Specify Table" window back to "SampleEvents" (you can change it back later) and click "OK". You've now "pointed" the calendar's events table at the events table in your file: eventually you'll be able to delete the SampleEvents table in SeedCodeCalendar.fmp12, but don't do it yet as you'll need it in the next step.
Note, if your events are linked to contacts, you can do the same thing with the SampleContacts table occurrences you see in the calendar, double click on the table occurrence, select your file (which now appears in the list of data sources) and select the contacts table in your file. Create a relationship between SampleEvents and SampleContacts using the same match fields you use for this kind of relationship in your file.
If you're using the gantt chart
you'll want to do the same thing to our SampleProjects table occurrence and our SamplePhases (if you're using Phases, if you're not just leave it alone). Point these at the relevant tables in your file and make sure that they are connected to SampleEvents by the unique ids in each table.
If you don't have a contacts or projects table, and wish you did, you may want to pause this integration and take a look at SeedCode Complete, which already has our calendar linked to a rich contacts and project management system.
If you deleted the sample Contact, Project, or Phase table occurrences from your graph as we do in our video, be sure to visit the script "Load Source Settings at Startup --- Describe Your Sources Here ---". There you'll see two variables declared with the name of these tables. Replace those table names with "" (blank) or the calendar will ask where they are when you run the calendar's upon opening script.
4. Layouts Part 1: Field Mapping
Navigate to the Source No 1 layout in SeedCodeCalendar.fmp12 and follow the instructions on the layout to map the fields there to the relevant fields in your events table. Map the "Summary" to a simple field for now like your event's title, just to get you up and running, then return here and try mapping the summary to something more interesting to create a multi-line
A couple tips on field mapping:
Events with just a single date should have a start date: if your event has just an end date the calendar will fail. The same goes for times: if there is only one time, make it the start time.
Don't use calcs for things like the dates, times, or resources. The calendar wants to edit these values when you drag items around, and it can't edit calcs. Use auto-enter calculations instead if you must.
5. Layouts Part 2: Event Details
Move to the Event Details layout in SeedCodeCalendar.fmp12 and edit this layout as you see fit, pointing the current fields to your
own fields. Just be sure to keep the following 3 objects: the "repeat" button, the "show repts..." button below it, and the large "close..." button at the bottom of the screen. You can come back and edit this layout later, for now, just get the Summary, Date, and Time fields lined up with the relevant fields in your events table.
If you're going to be using Web Direct you'll want to edit that version of Event Details: in Web Direct we show the event details in a popover. Learn how to point these popovers at your fields here: Formatting Event Popovers
6. Event colors in list view and mini windows.
This step is optional, but if you want to show an event's color "on" the event record in list view and in the Event Details mini window, follow these instructions
7. That's it.
Refresh the calendar and you'll see your events. Pretty simple.
Eventually you'll want to come back to the Event Detail layout from step 5 and get that just right, and consider color-coding events if that makes sense in your file. You'll also want to read through the script "Load Calendar Settings - On Startup --- Edit Configuration Here ---" making changes as necessary as this lets you change a number of the calendar's default settings.
If you'd like to change the name of "sample events" in the relationships tab, you can do that now, just read about this script you'll need to edit afterwards: renaming tables.
Take a look at the field you mapped to Resource and edit the Resources value list in the calendar so it matches the contents of that field: we used "location" as the resource in our video and changed the "Resources" value list in the calendar to point to an existing value list in the Meetings file. You may want to do something similar. More on resources.
If you need to set up filters on your own fields, then check out our section on filters.
Similarly, we changed some of the event colors to match the values in the field we mapped on the "Color" tab of Source No 1. Read more about colors here.
The "new" button on the calendar might not make sense in some cases: for example you may link to the "next contact date" of a contact record. In that case "new" would make a new contact. Maybe that is what you want, but likely you'd want to create a new "action" for a contact and so the contacts file in such example would have been better served by adding an actions or events table to it and linking that table to our contact: pasting in the Sample Events table from SeedCode Calendar would have been a way to start that.
In any event, think about the kind of records you've mapped to Source No 1 and Event Detail, and if you think you might need an action or events table, you hopefully now have the confidence to begin adding one.
And don't forget you can have more than one calendar at a time--more than one "source"--and have some from fields in a contact's record and other calendars from events tables. Learn more by reading about multiple sources.