分離モデルのイベント色

リスト表示とミニウインドウのイベント色

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.

# 
レイアウト切り替え ["Assign Colors" (Events)] 
# 
Loop 
#
変数を設定 [$sc_namesVariable; 値:Let ( [ 
s = CalendarColors::Name ; 
s = Substitute ( Lower ( s ) ; 
["\"" ; "" ] ; 
["(" ; "" ] ; 
[")" ; "" ] ; 
["+" ; "" ] ; 
["-" ; "" ] ; 
[">" ; "" ] ; 
["<" ; "" ] ; 
["=" ; "" ] ; 
["≠" ; "" ] ; 
["≤" ; "" ] ; 
["≥" ; "" ] ; 
["&" ; "" ] ; 
["^" ; "" ] ; 
["/" ; "" ] ; 
["*" ; "" ] ; 
[" or " ; "" ] ; 
[" and " ; "" ] ; 
[" not " ; "" ] ; 
[" xor " ; "" ] ; 
[" if " ; "" ] ; 
[";" ; "" ] 
) ] ; 
Evaluate ( "Let ( $$sc_Color" & s &" = " & CalendarColors::ColorRBGValue & " ; \"\" )" ) ) ] 
# 
ポータル内の行へ移動 [選択; 次の; 最後まできたら終了]
# 
End Loop 
# 
レイアウト切り替え [元のレイアウト] 
#

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).