Add Cascading Events to DayBack
Posted: Sun Dec 13, 2015 12:35 pm
Overview
These instructions show you how to add cascading event support to DayBack. This will let you chain events together (by default this is events within a project) so that date changes made to one event cascade to downstream events. Here is a quick demo of how this is implemented in SeedCode Complete: 1 min cascade example
The instructions that follow show you how to add the behavior to your own copy of DayBack.
Details
Note: these instructions are for DayBack version 9.63 only. If you have an older version, please update to 9.63 before continuing with this mod.
1. Add a new field to your events table called “DBk_LinkedWithinProject” when this is checked we’ll include an event in the cascade of changes. You can uncheck this field (set a 0 or blank in here) to omit an event from participating in cascades: as you might omit things that can’t move (federal filing deadlines) or that you don’t want to move (promises you made to the client).
This field is in the SampleEvents table in DayBack so you may have it already.
2. Download our reference file CascadingEventScripts.fmp12 and copy and paste these two scripts into your file: “Update Linked Events…” and “Refresh Linked Events”.
Note that the script “Update Linked Events…” uses actual field names from the SampleEvents table; if your field names are different you’ll want to edit this script to point to your versions of these fields, using the copy in CascadingEventScripts.fmp12 for reference.
This brings up a good point about modifying scripts in DayBack; the file uses a lot of abstraction to make the scripts easy to paste into your own file. Abstraction is stuff like using “SetFieldByName” instead of “SetField”. But when you’ve already integrated DayBack your subsequent modifications don’t need to continue this abstraction. One you’re working in your files—in your tables—you can use regular old SetField statements, providing you know which source your in if you’re using multiple sources.
3. Now edit the script “Submit Events from Webviewer” and add a new line 95: Perform script “Refresh Linked Events” right before the script’s last End If statement. You can see exactly where this line goes in the copy of “Submit Events from Webviewer” in the “CascadingEventScripts.fmp12” reference file.
4. Open our reference version of the script “Create Edit Delete Event…” and copy and paste lines 120 through 122 into your copy.
Then scroll dow and copy and paste the “update linked events” section from lines 235 to 250.
5. That’s it for script changes. Your events may not have any values in the field “DBk_LinkedWithinProject” so add that field to one of your events layouts and put a 1 in all the events for a single project: or add this field to the portal of events on your project’s layout (or the sample project’s layout in DayBack).
Once that’s done, changing the data of an item that’s part of a project will cascade that change to downstream events for the same project, provided that they’re marked as “linked”. Head over to the horizon view and filter the calendar to show just one of your projects: move the date sider so you can see a lot of events for the project. Drag an event and watch the changes cascade to downstream events.
Going Further
The script “Update Linked Events…” contains a find request to determine which events should cascade. The script currently finds events in the same project which are marked as “linked” and begin after the start date of the event you’ve edited. This is the find request you’ll edit to make your own rules: if you want to omit events that are already started, for example, just add a new omit find request before the script performs its find.
These instructions show you how to add cascading event support to DayBack. This will let you chain events together (by default this is events within a project) so that date changes made to one event cascade to downstream events. Here is a quick demo of how this is implemented in SeedCode Complete: 1 min cascade example
The instructions that follow show you how to add the behavior to your own copy of DayBack.
Details
Note: these instructions are for DayBack version 9.63 only. If you have an older version, please update to 9.63 before continuing with this mod.
1. Add a new field to your events table called “DBk_LinkedWithinProject” when this is checked we’ll include an event in the cascade of changes. You can uncheck this field (set a 0 or blank in here) to omit an event from participating in cascades: as you might omit things that can’t move (federal filing deadlines) or that you don’t want to move (promises you made to the client).
This field is in the SampleEvents table in DayBack so you may have it already.
2. Download our reference file CascadingEventScripts.fmp12 and copy and paste these two scripts into your file: “Update Linked Events…” and “Refresh Linked Events”.
Note that the script “Update Linked Events…” uses actual field names from the SampleEvents table; if your field names are different you’ll want to edit this script to point to your versions of these fields, using the copy in CascadingEventScripts.fmp12 for reference.
This brings up a good point about modifying scripts in DayBack; the file uses a lot of abstraction to make the scripts easy to paste into your own file. Abstraction is stuff like using “SetFieldByName” instead of “SetField”. But when you’ve already integrated DayBack your subsequent modifications don’t need to continue this abstraction. One you’re working in your files—in your tables—you can use regular old SetField statements, providing you know which source your in if you’re using multiple sources.
3. Now edit the script “Submit Events from Webviewer” and add a new line 95: Perform script “Refresh Linked Events” right before the script’s last End If statement. You can see exactly where this line goes in the copy of “Submit Events from Webviewer” in the “CascadingEventScripts.fmp12” reference file.
4. Open our reference version of the script “Create Edit Delete Event…” and copy and paste lines 120 through 122 into your copy.
Then scroll dow and copy and paste the “update linked events” section from lines 235 to 250.
5. That’s it for script changes. Your events may not have any values in the field “DBk_LinkedWithinProject” so add that field to one of your events layouts and put a 1 in all the events for a single project: or add this field to the portal of events on your project’s layout (or the sample project’s layout in DayBack).
Once that’s done, changing the data of an item that’s part of a project will cascade that change to downstream events for the same project, provided that they’re marked as “linked”. Head over to the horizon view and filter the calendar to show just one of your projects: move the date sider so you can see a lot of events for the project. Drag an event and watch the changes cascade to downstream events.
Going Further
The script “Update Linked Events…” contains a find request to determine which events should cascade. The script currently finds events in the same project which are marked as “linked” and begin after the start date of the event you’ve edited. This is the find request you’ll edit to make your own rules: if you want to omit events that are already started, for example, just add a new omit find request before the script performs its find.