Refreshing the Calendar

When does the calendar refresh?

When Editing Events or Navigating

When you click on an event in DayBack, the event is presented in a popover. When you close that popover, DayBack will refresh that event if you've modified the record. However, the calendar won't attempt to search for other events that may have been created by other users.

This means that edits and new event records created by other users won't automatically show up on your display without any interaction on your part. Normally this isn't a big deal as the calendar requests new events from the server each time you a) navigate from day to day, b) apply resource filters, or c) switch views (like from month to day view). But if you're just staring at your screen, you may want to manually refresh to make sure you have the latest data from the server.

Manually Refreshing

Click the refresh button below the date in the calendar's header:

If you right-click anywhere in the calendar's display you'll see an option to "reload..."; select that and DayBack will refresh the display AND fetch any events that may have been created by other users.

Refreshing with a URL or Custom Action

You can refresh the calendar from your own code by using the DayBack URL parameter refresh=true or by using this method in your JavaScript custom action


Enable Auto-Refresh with Kiosk Mode

You can also put the calendar into auto-refresh mode by using the URL  ?kiosk=10#/ where "10" is "refresh the calendar every ten minutes." This can also be enabled in an action using the startKioskMode function.

Refreshing a Found Set of Events in FileMaker


Although it's possible to refresh the entire calendar using a URL parameter or Custom Action as described above, you may want to make a more targeted refresh of just certain events. A common modification in DayBack is modifying the stock scripts so that when one event is modified in DayBack, additional events are also modified. For example, if an event that's related to a project is pushed out a day, all downstream events related to that project are also pushed out a day. How can we show the changes to all these events in DayBack without doing a full refresh? SeedCode has created an update file that contains two scripts that you can copy and paste into your existing file or into a stock copy of DayBack. The script Update Events On Calendar - DayBack is the script you'll call to send all of your FileMaker side edits to DayBack. The example script Bump Not Started - DayBack has also been added to the file to show how to call the Update Events On Calendar - DayBack script.

Using the script

The script  Update Events On Calendar - DayBack itself should not need to be modified and the only requirement is that the DayBack web viewer is in focus so that it can receive the payload of events. It should be called as a sub-script with a parameter formatted as a list of the values returned by the DBK_JSON field that you've added to all your calendar sources. If you are in a found set, this would be the same value returned by the DBk_JSON_ListOf summary field.

Simple Example Script

#cancel all my events today
New Window [ Style: Document; Name: Get ( ScriptName ); Using layout: “Sample Events” (SampleEvents_DayBack); Close: Yes; Minimize: Yes; Maximize: Yes; Resize: Yes; Menu Bar: Yes; Dim parent window: No; Toolbars: Yes ]

Set Error Capture [ On ]
Enter Find Mode [ ]
Set Field [ SampleEvents_DayBack::Resource; Get ( AccountName ) ] 
Set Field [ SampleEvents_DayBack::DateStart; Get ( CurrentDate ) ] 
Perform Find [ ]
If [ not Get ( LastError ) ]
	Replace Field Contents [ SampleEvents_DayBack::Status; Replace with calculation: "Canceled" ]
	Sort Records [ Restore; No dialog ]
	Set Variable [ $eventsToUpdate; Value:SampleEvents_DayBack::DBk_JSON_ListOf ] 
End If
Close Window [ Name: Get ( ScriptName); Current file ] 

#update events in DayBack
Perform Script [ “Update Events On Calendar - DayBack”; Parameter: $eventsToUpdate ]

Updating Shares

In addition to updating the view in DayBack, the script also allows you to update and delete existing events on Shares that contain the specified events, even if those events are not in the current view.

Updating your existing file

You can update your file by downloading the DayBack Scripts-Refresh file and then copy the following scripts from the example into your current file:

  • Update Events On Calendar - DayBack
  • Bump Not Started - DayBack

Please update the BuildNumberCalc field in the DayBackHelper table to keep track of your changes.

The Bump Not Started - DayBack script is not required, but it's recommended to download this script to get you started if you want to use this new feature.