SeedCodeCalendar

Event Colors

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 are events color coded?

The calendar colors events based on the contents of a field of your choosing. We call this field the event "status" in the documentation and sample file, but you can use any field you'd like.

Setting up color coding begins on the Source No X layout (Source No 1, Source No 2, etc.) you made when integrating the calendar. That layout has a tab called "colors" on which you can specify the field you'd like to use for color coding.

(Note: We also have a color field in the events table so we can show a color beside the event on the Event List and Event Details layouts. This calc (SampleEvents::z_sc_ColorCalc) begins with a Let() statement were you can specify which field is being used for your colors.)

Then, on the Settings tab of the calendar you'll see a button called "assign colors". Click that and you can drag a color into each one of your "status" values.

A few notes about how this works...

The portal on the left is based on records from the CalendarColors table and the "new status" button will make a new record in that table so you can create as many "statuses" as you want.
The portal is sorted by the value list "Status" so you'll want to keep that value list in synch with the contents of this portal. We use a by-hand value list here instead of basing the value list on CalendarColors records because we like how you can specify the sort order of a value list and use separators ("-") that you can't when you base a value list on a field.
You can override the color of any status by simply typing a new RGB value into each row.
You can easily alter the pallets of possible colors by editing the field definition for the field "CalendarInterface::ColorRGBValues" where the RGB values of each pallet are declared.

Can I color code by Source instead of by a field?

Yes. Toward the end of the script "Load Calendar Settings - On Startup..." you'll see a setting for this: set that to "1". Then change the names entered for the "statuses" in the screen above to be the names of your sources. Use the same names you're using on the first tab on your Source No X layout.

Can I color by a field outside the Event, like the Event's Project's Status?

Yes.

So this is kind of a big-picture thing. The calendar is designed to be easily integrated-- that is why we have field mapping layouts like "Source No 1" and get your color field from there. However, once you HAVE integrated the calendar, you can stop relying on some of our abstractions and hard-code some things. So if your source isn't going to change (you're not going to point the calendar at another table) you can get creative with this....

Edit the script "Write One FileMaker Event in iCal Format" and find the line where we set the variabel $scical_Status

That is the color line. In that calc, replace GetField ( $$sc_FieldForStatus ) with a look at your event's related project and grab that color if there is one. Remember, we're on the Source No 1 layout when this happens, so you'll need a valid relationship to projects from there, but assuming you have one, that calc could begin...

Let ( [

p = RelatedProject::Color ;
s = if ( isempty ( p ) ; GetField ( $$sc_FieldForStatus ) ; p )

] ;

Note that you'll have to make sure your colors match the possible values of a project's status on the Settings tab's "assign colors" screen.

Troubleshooting Colors

Here are some tips to make sure color coding works as you expect.

1. Make sure that the field you use for color mapping on the Source No X layout, and the field you use in SampleEvents::z_sc_ColorCalc are the same fields.
2. If no events show up with colors navigate to the Calendar Records layout in layout mode and make sure there is a big chunk of color in the field CalendarColorGlob. If there isn't, run the upon opening script again.
3. If that doesn't get any color visible in that field (it should be visible in the field without you having to enter the field with your cursor), copy and paste the contents of that field from an uncloned copy of the file.
4. Finally make sure the value list of possible statuses (or whatever value list you're using as possible values for your color coded field) matches the list of values shown in the Assign Colors layout.
5. Older versions of the calendar can have a problem with operators in the color name (the event status). You can read up on this issue and check out some workarounds here.
(855) SEEDCODE
[email protected]
Follow us: