Be Informed - best practices and patterns (case events)
Mar 12, 2021
Be strict with event data #
Values and attribute sets quickly accumulate in events. With handler groups, execute events, schedule events etc. it is very hard to keep track of where which values are set and available in the context. It is advised to tidy up values and attribute sets in events after usage. Only let them continue to exist in the event if you are certain they should and will be used further on. Not being strict with event data will cause unforeseen application behaviour because values might be lingering on in the event changing apply-instrument behaviour, conditionals or something else.
This also very much applies to Execute Event handlers, be very strict which data you want to pass to an event and which data you need to merge back.
Pattern: backup and restore values #
A common requirement is that you need just one or several values from an attribute set, but still need to load a specific data store or load record handler to get the attribute set containing those values. Now your event data is contaminated with values you do not need and may interfere with the rest of the process. For this the pattern: backup and restore values can be used. It consists of 5 elements:
- Load your data (attribute set)
- Backup values you wish to preserve ([Set value handler], e.g. the value ValidDate can be stored in BAK_ValidDate)
- Clean up event data ([Remove value(s) from event data], link attribute set)
- Restore values from backup ([Copy values], Source: BAK_)
- Clean up event data ([Remove value(s) from event data], the specific BAK_ fields)
Don’t forget to clean up the preserved values from the event data, once these values are no longer needed.
Change log #
20210312 - Added Be strict with event data + Pattern: backup and restore values