SeedCodeCalendar

Adding Fields

These are the docs for our FM10/11 version of the Pro Calendar. Docs for the newer, FM12 version of our calendar can be found here.

How can I add my own fields to the calendar?

Overview

Most of the formatting of how things look in the calendar is done on the Source No X layout (Source No 1, etc.) where you specify which field (perhaps a calc) is used for the Summary-- that is the event attribute we show on all the calendar screens. Using a calc for your Summary field lets you show whatever you like on the calendar (perhaps a user's initials and then the event description, for example). More here.

But on the Day View you have a bit more room and may want to show something besides just the Summary.

Day View

You can place any fields from your events table right on then Day view of the calendar, and you can even make these fields enterable if you'd like, but there are a few caveats about that below.

To add a field to the day view, create a relationship from CalendarRows to SampleEvents like this:

CalendarEventUIDCalc_FirstValue = _id

Where _id is the primary key (the unique ID) in your events table. All this relationship is for is to allow you to add fields right from your events table to the daily view.

Next go to the Day Tab of the calendar in layout mode (see Editing the Calendar Layouts if you don't know how to get to the day tab in layout mode). Then simply add fields from your event table-- that would be a field from Sample Events in the original calendar file.

Next, change the Refresh Window step at the end of the "Refresh Calendar..." script to use the Fluch Cached Join Results option. If you're on a Mac you can leave it like this but if you're on windows or want the best possible performance you can wrap it in an If statement so it uses the Flush option only when $$sc_Mode = "Day Sched" and uses a regular refresh elsewhere.

Multiple Data Sources

And, obviously, this only works for one table at a time unless you'd like to set up similar relationships to each of your FileMaker events tables-- if your primary keys are all prefixed, only one relationship will be "true" at a time, so you can stack fields form other events this way. If your primary keys aren't prefixed get in touch with SeedCode as we have some custom solutions that can help with this.

Enterable Fields

Note that if you allow entry to fields in your events table you may edit information that should cause an event to move or change color. Yet FileMaker won't know to do this just because you edit the field. In such cases you'll need a script trigger on your field (we recommend the OnObjectSave trigger) that will call the script "Refresh Calendar { UseExistingData ; DontRefresh }". Don't send any parameters to the script.

Changing fields per tab

Can I show different fields on some views of the calendar?

Overview

Yes. The section above describes how you can add your own fields to the Day view, but you can also change what shows up on other views. In this example we'll describe how to set the Month view to show just a field in your events table called "My Field", leaving the other views to show the field(s) you've mapped to the calendar's Summary.

The Modification

Begin by backing up a copy of your file. ;-)

1. Edit the script "Write One FileMaker Event in iCal Format" and find the line where we're setting the variable $scical_Summary.

2. Change that calc from this...

GetField ( $$sc_FieldForSummary )

...to the code below where "SampleEvents" is the name of the table occurrence for Source No 1 in your file, and "SampleEvents::MYField" is the name of the field you wish to show on the month view. Note that the case statement here lets you specify different settings for other views as well, and leaves the mapped field, represented by GetField ( $$sc_FieldForSummary ) as the default for other views and other sources.

  Case ( 
    Get ( LayoutTableName ) = "SampleEvents" ; // the table occurrence for Source No 1
        Case ( 
           $$sc_Mode = "Month" ;  SampleEvents::MYField ;
           $$sc_Mode = "Week Sched" ; GetField ( $$sc_FieldForSummary ) ;
           GetField ( $$sc_FieldForSummary ) // Default for other modes
        )
    ; GetField ( $$sc_FieldForSummary ) // Default for other sources/tables
  )

For your reference, here is a list of all the possible modes in the calendar and the views they represent: Modes In The Calendar.

Note that if you will only ever have one source you can dispense with the Get ( LayoutTableName ) test-- this does add a slight bit of weight to the calendar. If you dispense with this you'd remove the first two lines, and the last two lines from the calc above.

3. At this point, MyField will show up on the month view beside the event's time if there is one. If you'd like to remove the time as well, edit the script "Format Event Time --- Edit Time Formats for Events Here ---". Edit the very last SetVariable statement in the script and you'll see that right at the beginning, on the 4th line, we've commented out a line about the Day View. Uncomment this line changing the mode form "Day Sched" to "Month" and you'll have remove times from displaying on the month view.

Enjoy!

(855) SEEDCODE
[email protected]
Follow us: