SeedCodeComplete2

Multiple Sources

How can I show records from more than one table in the same calendar?

Overview.

Traditionally a portal can only show records from one table occurrence, though it can include fields from other table occurrences related to the one the portal is based on.

This calendar, however, can include events from completely unrelated tables--each of which becomes a "data source" for the calendar. In this way you might have one source be an events table holding things like followup calls, meetings, etc. And have a second source by your jobs table where you have job due dates.

You can even have multiple sources from within the same table: if, for instance, you had a job due date in your jobs table and a followup date in your jobs table, you'd create those as two separate sources.

You can even have sources that aren't FileMaker tables by creating sources that represent iCal URLS. In this way you can mix events from an iCal URL among your FileMaker records.

Note that version 3.0 of SeedCode Complete removed the ability to show iCal sources along side your FileMaker Records; this was slowing down the calendar a bit and with Zulu it didn't seem necessary any more.

One you set up multiple sources, users can turn sources off and on using the Sources tab in the left hand sidebar.

'Having multiple sources can show up in the calendar's speed. So be judicious as to how you use this.''

Creating a Second FileMaker Source.

Each source in the calendar is represented by a layout. You'll see a couple of these layouts in the calendar's example file: they are names "Source No 1" and "Source No 2". Any new sources you create will need a layout named the same way.

Here is how you'd create a new FileMaker source...

1. Duplicate the "Source No 1" layout and rename it Source No 3 (or your next unused source number).
2. Enter layout mode, then layout setup and base this new layout on the table you'd like to show records from. In our example, we'll call this "Orders"
Note that you may want to make our Events table a child of your orders table so that you can see multiple events per order. Making "orders" a source in itself is best for showing a singular fact about each order (like a due date) in the calendar.
3. While still in layout mode, visit each of the configuration tabs and enter the details or map fields specific to your source. Enter browse mode when you're done and review each tab for errors. You'll have to add the same fields to this table (to "Orders" in our example) in order to complete a few of the Required fields. These fields are:
z_sc_TimestampEndCalc
z_sc_TimestampStartCalc
You'll also want to add the following auto enter calc to your TimeStart field (if you don't have a time start field, create one):
Case ( Self = Time ( 24 ; 0 ; 0 ) ; Time ( 24 ; 0 ; 1 ) ; Self = Time ( 0 ; 0 ; 0 ) ; Time ( 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.
If you want to show event colors in list view as we do in the Event List or Event Detail layouts, copy our field "z_ColorCalc" from CalendarEvents and add it to your "Orders" table mapping our field "status" to the equivalent field in your table: this is the field we used to color code events in the calendar. Note that the calendar shares the same list of statuses and resources across all sources.
4. Create an Event Detail layout for this source: this is the small layout you'll use to view the event when you click on it in the calendar (this is the layout you named next to "display layout" on the Required Layout Info tab). We recommend creating a small detail layout even if you want folks to jump to a layout you already have (like an orders layout) when clicking on an event. Having a small mini-window come up can help users quickly look at an event and then close that window without loosing their place in the calendar. Add a button to this layout to jump them to your main layout if they need more. Here's how: jump to my event.
5. Edit the script "Load Settings - On Startup --- Edit Configuration Here ---" and find the comment "Which sources are active by default". If you want your source to be shown in the calendar at startup, add it's number to the List () function after that comment. If you don't do anything here your source will show up as a possible source on the Sources tab, but its events won't show in the calendar unless a user elects to click on that source.
6. If you're creating Source No 5 or lower, you're done. Enter browse mode, run your Upon Opening script and enjoy. If you're creating Source No 6 or higher you'll need to edit a few scripts where we've hard coded source numbers into the calendar. (This is faster than looping through them, but we apologize for the inconvenience.) You'll find Source counts below comments "Abstract for sources" in the following scripts:
Insert iCal File Into Calendar { UseExistingData }
Click in / Drag Event
in the first Set Variable after the comment "Create a new record"
Clear iCal Variables
Clear Source Variables
Clear iCal Parsing Variables

iCal Sources

Overview.

Note that version 3.0 of SeedCode Complete removed the ability to show iCal sources along side your FileMaker Records; this was slowing down the calendar a bit and with Zulu it didn't seem necessary any more.

You create a new iCal source in much the same way as you create a FileMaker source, it is just a lot simpler since almost all the work is done on the Source No X layout.

Regarding our iCal Example.

The URL we use for our example is from John's yoga studio. This iCal only returns events for the "next two weeks" (the yoga studio has set it up that way). So if you're looking at a date in the past, you likely won't see any iCal events. Navigate to "today" and then click on the "Yoga Schedule" on our Sources tab to see how this works.

Caveats.

iCal sources can really slow the calendar down, however, especially if you refresh them frequently (there is a "refresh every" X hours attribute on the Source No X layout to help alleviate this) or if your URL has a ton of records in the past. You might start by editing the iCal example we have (editing the Source No 2) layout to see if the iCal source you're interested in is fast enough.

Grabbing an iCal URL also requires a plugin. We're using the free ScriptMaster plugin for this and you can download a copy here: http://www.360works.com/scriptmaster/ Follow the installation instructions that come with the plugin.

Adding an iCal source.

1. Duplicate the "Source No 2" layout and rename it Source No 3 (or your next unused source number).
2. Enter layout mode and visit each of the configuration tabs and enter the details required for this source. Note that we don't color-code iCal events by "status" but you can color code by source if you want: more here.
4. All iCal events share the Event Details web layout so there isn't really anything to do here though you may want to make that layout larger depending on the kind of information you're looking at.
5. Edit the script "Load Calendar Settings - On Startup --- Edit Configuration Here ---" and find the comment "Which sources are active by default". If you want your source to be shown in the calendar at startup, add it's number to the List () function after that comment. If you don't do anything here your source will show up as a possible source on the Sources tab, but its events won't show in the calendar unless a user elects to click on that source. iCal sources can be slow (they have to be downloaded, then processed) so you might not want this happening on launch.
6. If you're creating Source No 5 or lower, you're done. Enter browse mode, run your Upon Opening script and enjoy. If you're creating Source No 6 or higher read step 6 above and make changes to a few scripts.
That's it.

Troubleshooting.

If you're having trouble getting your iCal source to show up, here are a few tips:

Make sure the URL ends in .ics If it doesn't, try adding the URL to iCal proper and you'll see the real URL (the one ending in .ics) pop up in iCal's confirmation message: copy this url and use it.
Make sure your url begins with http:// not webcal:// (just switch it).
Check the $$sc_iCal[X] variable in the data viewer to see if you're getting any events in from the URL ("X" in this case is the source number for your URL). If you don't see anything here, the URL isn't properly formed or there is no file at the end of it.
If you do see data in the $$sc_iCal[X] variable, make sure the events are in the current year: iCalShare in particular has tone of out of date calendars listed as their "most recent". Find a date in the variable where there is an event...
Look for the DTSTART value. A date like this, "VALUE=DATE:20100214" means February 14th, 2010
... and then navigate to that event in the calendar to see if it is showing up.
(855) SEEDCODE
[email protected]
Follow us: