SeedCodeCalendar12

Separation Colors

Event colors in list view and mini windows

If your calendar interface and your event-data tables are in different files, ("the separation model"), and you want to show an event's color "on" the event record in list view and in the Event Details mini window, you'll need a table occurrence for the "CalendarRows" table in your data file (it doesn't need to be related to any other T.O.), and you'll need to add the "z_sc_ColorCalc" field from our SampleEvents table into the Events table in your data file (just copy/paste it if you have FileMaker Advanced).

The "z_sc_ColorCalc" field looks for global variables that are now scoped to your interface file, so you need to create these variables in your data file as well. Here's how:

Create a Cartesian (the "x" operator) relationship in your data file to the "CalendarColors" table from any other table (your "Events" T.O. perhaps?). Then make a new layout called "Assign Colors", based on that same T.O. (e.g., "Events"), and copy/paste the Calendar Colors portal from the "Assign Colors" layout in the interface file.

Then create a new script in your data file called "Apply Color Settings in Data File" by copy/pasting only the steps shown below from the Calendar file's "Apply Color Settings { Close ; DontRefresh }" script.

#
Go to Layout ["Assign Colors" (Events)]
#
Loop
#
Set Variable [$sc_namesVariable; Value:Let ( [
s = CalendarColors::Name ;
s = Substitute ( Lower ( s ) ;
["\"" ; "" ] ;
["(" ; "" ] ;
[")" ; "" ] ;
["+" ; "" ] ;
["-" ; "" ] ;
[">" ; "" ] ;
["<" ; "" ] ;
["=" ; "" ] ;
["≠" ; "" ] ;
["≤" ; "" ] ;
["≥" ; "" ] ;
["&" ; "" ] ;
["^" ; "" ] ;
["/" ; "" ] ;
["*" ; "" ] ;
[" or " ; "" ] ;
[" and " ; "" ] ;
[" not " ; "" ] ;
[" xor " ; "" ] ;
[" if " ; "" ] ;
[";" ; "" ]
) ] ;
Evaluate ( "Let ( $$sc_Color" & s &" = " & CalendarColors::ColorRBGValue & " ; \"\" )" ) ) ]
#
Go to Portal Row [Select; Next; Exit after last]
#
End Loop
#
Go to Layout [original layout]
#

Make sure this script runs when your data file opens (note that if this script is set up to be triggered by "OnFirstWindowOpen" and your data file never actually opens in a window, these color settings won't be propagated).

(855) SEEDCODE
[email protected]
Follow us: