Additional Filters in DayBack for FileMaker
You may want to add your own filters on top of the text, status, and resource filters that come with DayBack.
While you can add some additional filters via URL (like for contacts and projects), you can also filter your FileMaker sources by customizing the scripts DayBack uses to find your events. DayBack even comes with subscripts written just for this purpose, making this one of the easiest and most powerful ways to add filters to DayBack.
How It Works
Open up the script "Apply Additional Filters - DayBack" in DayBack's FileMaker file. This script runs every time DayBack fetches your FileMaker events. So any find requests you include here can be used to constrain the found set DayBack is building. That's pretty cool.
Open the script and ignore the Set Variable lines at the top of the script. Find the first If statement and you'll see that's it's looking for a calendar named "Events". Switch that to "Sample Events" or to the name of the calendar you'd like to filter.
Inside that If statement, you'll see some disabled text to perform a "constrain found set". Use those as your example for any additional filter criteria you'd like to add to this calendar.
You'll see an Else If branch for a calendar named "ToDos"--switch that to "ToDo List" or to the name of any other calendar you'd like to filter. DayBack can show multiple FileMaker calendars at the same time and you'll want to include a branch here for each calendar that needs additional filters.
Are you using WebDirect?
If you're using WebDirect, you'll want to edit a slightly different script named "Apply Additional Filters - SQL - DayBack". (If you have users running WebDirect and FileMaker client, you'll edit both of these scripts.) While DayBack uses Find requests to retrieve your events in FileMaker client, it uses SQL to "find" your events in WebDirect. So if you want to constrain the find in WebDirect, you'll use this script to add an additional WHERE clause to DayBack' SQL request.
Hidden Filters (Pre-Filtering)
One application of these subscripts is to pre-filter the calendar. The example code in the disabled lines within these scripts show what such pre-filtering looks like: these are not filters users can interact with. The author of these scripts has hardcoded a filter inside the script, hiding that filter from the users.
This is one way, for example, to constrain the calendar to only show events that belong to the logged-in user.
The other reason developers use these scripts is to create additional filters that users can interact with. For example, you may want to add filters for "work type" and "procedure code" to the status field already in DayBack. To do this, you'd create global fields for "work type" and "procedure code" and add these to the calendar layout in a new header, footer, or sidebar.
Then, inside the script "Apply Additional Filters - DayBack" in DayBack's FileMaker file, you'd test to see if either of these global filters had values (to see if the users had asked to filter by "work type" or "procedure code"). If so, you'd enter find mode and set the contents of these global fields as the find criteria for your constrain.
In this way, you can create as many additional calendar filters as you need.