カレンダーの組み込み
Embedding SeedCode Calendar Free into your File: Pasting It In
These instructions show you how to paste SeedCode Calendar into your file and use an events table you already have for the events you'd like to see in the calendar. If you want to use the Sample Events table in SeedCode Calendar as your events table, just import it into your file in step 2 below and skip step 5.
Tips for an Easier Integration
The best advice I can give you is to go slowly, read carefully, and Do Things In Order. FileMaker is very sensitive to the order in which objects are created. So even if you know a better or faster way to do some of what follows, save that for your next calendar integration, and do this one carefully, step by step.
And if you really want to get up and running quickly, consider linking the calendar, instead of embedding it.
1. Backup your file.
Really.
And this is important: review a couple of things you may want to change in your file before you get started.
2. Fields.
2.1 Add three new fields to your event's table from SeedCode Calendar's Sample Events table:
zscEventSummaryCalc
zscTimestampEndCalcNum
zscTimestampStartCalcNum
Edit the definitions for these calcs, removing any leading / trailing comment tags if you pasted the fields in using FileMaker Advanced (that is, remove the /* and */ from the beginning and end of the calc. Then replace the Summary, Description, DateStart, TimeStart, etc. fields in these calculations with the relevant fields from your events table. Make the last two calcs return the form "number" and that all three are indexed.
2.2 Next, add the following Auto-Enter Calculated Value option to the TimeStart field in your events table:
Case (
Self = Time ( 24 ; 0 ; 0 ) ; Time ( 24 ; 0 ; 1 ) ;
Self = Time ( 0 ; 0 ; 0 ) ; Time ( 0 ; 0 ; 1 ) ;
Self = Time ( 0 ; 0 ; 0 ) ; Time ( 0 ; 0 ; 1 ) ;
Self > Time ( 24 ; 0 ; 0 ) ; Self - Time ( 24 ; 0 ; 0 ) + 1 ;
Self )
Self = Time ( 24 ; 0 ; 0 ) ; Time ( 24 ; 0 ; 1 ) ;
Self = Time ( 0 ; 0 ; 0 ) ; Time ( 0 ; 0 ; 1 ) ;
Self = Time ( 0 ; 0 ; 0 ) ; Time ( 0 ; 0 ; 1 ) ;
Self > Time ( 24 ; 0 ; 0 ) ; Self - Time ( 24 ; 0 ; 0 ) + 1 ;
Self )
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.
Add the same auto enter definition to your end time field, also unchecking the "Do not replace existing value" checkbox.
3. Tables.
Import two tables into your file from SeedCode Calendar: CalendarRows and CalendarInterface. If you were ever wondering why people bought FileMaker Advanced, this is why. If you don't have Advanced, from your file select File / Import Records... / File and then select the SeedCodeCalendar file. Select the first of the three tables to import and for the target, select "New Table". FileMaker will create the new table and calcs for you but you'll have to come back and uncomment some of the calcs that couldn't find the items needed: come back after you've imported all three tables this way and remove the leading /* and trailing */ from your calcs.
If you don't have Advanced, and that sounds like too much, we'd be happy to complete this step for you, just send us your file.
4. Value Lists.
Open SeedCode Calendar Free and recreate the "Yes No" and "Calendar Times" value lists from our file in yours.
5. Table Occurrences.
Create a new occurrence of your events table (the table that has the records you want to see on the calendar) and name it "SampleEvents" (make sure there are no spaces in the table occurrence name). You can change this name later.
6. Relationships.
On your relationship graph, link "CalendarRows" to "CalendarInterface" as show on the graph in SeedCode Calendar Free. Double check that the table occurrence names match what we have in the sample file.
7. Layouts Part 1.
Delete the default layouts created when you imported tables in step 3.
Create a few blank layouts in your file. (We'll paste in the content for these layouts in a subsequent step.) You'll create one layout in your file for each layout in SeedCode Calendar (even though only some layouts are visible to users, all these layouts are required). Layouts are either based on Calendar Rows, Calendar Interface, or Sample Events. Once you're done, go through and make sure these layouts have exactly the same names as the ones in SeedCode Calendar Free.
You'll need to delete the headers and footers from these layouts, so if you do that on your first of these layouts, and then duplicate it for your new layouts, things will go faster. Just be sure to remember to change the layout context as appropriate.
You also want to set all these new layouts to the Classic theme; again, doing this on the first layout and duplicating will speed it up. You'll probably also want to uncheck the two layout options "Show field frames when record is active" and "Delineate fields on the current record only".
You may want to create the separator layouts we have as well (these are based on Calendar Interface) but that is just cosmetic.
Now you may already have layouts you want to use for your Event List and Event Details. If so, take a moment to read about that here: using your own Event layouts.
When it comes to skins, you don't need to create the Additional Skins layouts unless you want to. If you're planning on using one of these skins instead of our default skin, you can paste the contents of those layouts into the "Calendar" layouts in step 9 below.
8. Scripts.
Import the scripts from SeedCode Calendar Free. When importing, just click the check box beside the folder "SeedCode Calendar" and all the scripts within that folder will import. There will be a number of errors reports when you import (< 20): this is normal. In "Setup" below we'll remap some of the fields and settings in these scripts to values in your file.
However, if any scripts are reported as being "renamed" because of a conflict, quickly scan the imported scripts for names ending "2" and correct them. For example, the calendar has a script called "Upon Opening". If you already have one with that name ours will get imported as "Upon Opening 2". To fix this rename yours to something like "Upon Opening Main" and then rename ours to "Upon Opening". Our scripts must have the same names as they do in the SeedCode Calendar file for the following step to work.
9. Layouts Part 2.
Now select all and copy the layout contents from each layout in SeedCode Calendar and paste them into the layout of the same name in your file. And yes, we do need the contents of "Calendar Records" on that layout. You'll be warned that you'll be increasing the size of each layout; that's OK.
After each paste, grab the layout's right margin and move it over to match the right-most edge of our blue header, at 1,170px on most layouts. If you click in the upper left of the blank layout before pasting, the new layout objects will be flush top left as soon as you paste. If they're not for some reason, drag them flush top left and pull the bottom border of the layout up to meet the bottom edge of the objects: 650px on most layouts.
When you get to Event Details feel free to edit this layout as you see fit, adding your own fields and buttons (you can, of course, come back and do this later). Just be sure to keep the large "close..." button at the bottom of the screen.
When you get to Event List you'll see that the layout has 5 parts (header, sub-summary, etc.). Create the same parts in your layout (select "Print Above" for the sub-summary part) and make them the same size as ours, then paste in the layout contents. (Much simpler this way.)
10. Layout Script Triggers.
Assign script triggers. Since layout level script triggers don't come over when you copy and paste layout elements, you'll have to recreate these. Fortunately there are only a few.
Layout: Calendar Home & Docs (1 trigger)
Trigger: OnRecordLoad - "Load Home Layout" (browse mode and find mode)
Layout: Calendar (1 trigger)
Trigger: OnRecordLoad - "Load Calendar Layout" (browse mode and find mode)
(Do this on the "Calendar - no Side Menu" layout also.)
Layout: Event Details (1 trigger)
Trigger: OnRecordLoad - "On Event Record Load"
If you brought the additional skins layouts over separately, apply the second two triggers to them as well.
11. Setup.
Go to the layout "Calendar Source Data" and follow the directions on the layout to map the fields there to the fields in your SampleEvents table.
12. Clean Up.
Go to File / File Options / Script Triggers and add the script "Upon Opening" to your file's OnFirstWindowOpen.
Now is the time to rename your SampleEvents table occurrence to something that makes more sense for you. When you do, be sure to edit the first Set Variable in the script "Load Source's FileMaker Fields --- Edit which Tables to use here ---" to teach it about the new name of your table occurrence.
13. Run a Script.
That's it. Run the script "Upon Opening" script and you should see your events in the day view.
Enjoy!