Using Calculated Fields for Status or Resource in FileMaker

Usually, you'll want map status and resource to editable fields in FileMaker so that you can reschedule events in DayBack by dragging them to new statuses and resources. But sometime you'll want these fields to be calculated fields so that you can, for example, base the color on an If() statement, or combine several fields into one resource field.

You'll also use this technique (changing DayBack's edit script, below) if you want to edit a related value instead of a local field in the event. Below you'll see an example of editing the status of a related Job when you're changing the status of the job' delivery record.

Using Auto-Enter Fields

The simplest way to accomplish this is to make your fields auto-enter calcs instead of actual calculation fields. This lets the fields be editable but your calculations still fire, cleaning up any edits made.

Using Calculations: changing DayBack's Edit Script

If you can't use auto-enter calcs, you can certainly map these fields to calculated fields. You'll just need to edit one of DayBack's FileMaker scripts to handle what happens when edits in DayBack attempt to edit your calculated field. Without a change to this script, you'd get a 201 error that your field can't be modified.

Here's the script change...

Edit the script "Create Edit Delete Event - DayBack" and find the comment "RESOURCE" at around line 196. (If you're working on your status, it's the same idea, but you'll be looking for "STATUS" around line 212.)

You have two options: 

If you just want to ignore edits to your calculated field, disable the "Set Field" step right after the comment "Set the field."

If you want to edit another field, like the ID of your resource, for example, edit the "Set Field" step to manipulate your desired field instead. Remember, that "$value" in this case will be the name of the status or resource selected in DayBack.So if you're setting an ID you'll need to find that name's ID inside this script (or in a subscript) before setting the ID field here.

A few things to keep in mind

DayBack supports multiple values for both Status and Resource. So in those cases, $value will be a return delimited list.

You don't need to use Set Field By Name. SeedCode uses that so it's easy to point DayBack at any table. But once you're working with your table, you can just set your field directly.

Remember that you may have multiple calendars (and thus multiple resource/status fields) so you may want to test for what calendar you're in before choosing which field to edit. You have access to the $calendarName and $table in this script, so your script may look like this if only one of your tables has a calculated status. In the example below, we want to set the Job's status instead of the delivery status if we're on a job-delivery record:

Still need help? Message Us Message Us