Result
Understand how to add contextual information to an Event Definition.
Tutorial steps
- Create new Event Attributes
- Link an Attribute to an Enumeration
Event Attributes are additional pieces of information that can be associated with each event period created manually or generated by Flow. These additional pieces of information, when associated with event periods and overlaid onto time periods, provide context-rich information that supports decision-making and provide insight.
An Attribute can be "Retrieved" from a data source, "Manually Entered" by a person on an Event Period form, or "Calculated" from other attribute values.
Let’s add context to the "Filler 1 Run" Event you created earlier. Open the "Filler 1 Run" Event and expand the "Attributes" section. Undeploy your Event so that you can make configuration changes to it. Right-click in the "Attributes" section and select "New" > "Attribute" > "Retrieved". Name your new Attribute "Product", and select the Properties tab:
Notice the dropdown selection for "Palette". This selection specifies the palette of colors that will be assigned to the attribute values (e.g. Orange, Apple, Lemon, etc.).
Note: You can only make changes to the palette after the event has run and created event periods with attribute values.
Locate the "FL001.Product" item in your Historian and create a tag from it by dragging it onto the "Filler 1" metric. Now, drag that tag onto the Product Attribute.
Flow creates a new attribute "Segment" named "FL001.Product" …
For the properties of this segment, change the "Enumeration" property to "Filler Product".
Segments
A "Retrieved" Event Attribute can be made up of one or more Segments concatenated together. The following Segment types are available:
- Retrieved – the value of the segment is retrieved from a Data Source. If the retrieved value is an integer, the segment can be linked to an Enumeration to map the integer values to string values.
- Constant – this is a constant string that can be added as part of an Attribute. This is useful for generating Attributes for Batch Numbers.
- Period Start – this segment uses the start date and time of the event period. Use the "Format" property to change the way you want the date and time to be displayed.
- Period End – this segment uses the end date and time of the event period. Use the "Format" property to change the way you want the date and time to be displayed.
- Period Index – this segment uses a unique Index that Flow assigns to each event period created
Use Attributes to generate additional Context
By making use of the Attribute Segments, you can actually generate information without the need to access your data sources. For example, your Historian does not provide any data relating to the Work Order being run by your Filler. Let’s create a "Work Order" Attribute for your "Filler 1 Run" event.
Create a new "Retrieved" Attribute called "Work Order", and add the following Segments to it:
- Constant "FL001"
- Period Start formatted to "yyyy" (i.e. only the year)
- Period Index formatted to "0000" (i.e. always 4 digits)
Deploy your "Filler 1 Run" event again, open the diagnostic grid on the Attributes and confirm the attribute values coming through for each event period:
Notice how the "Product" attribute has been mapped to a string value for the product.
Notice how the "Work Order" attribute has been made up of:
"FL001" + Period Start (yyyy) + Period Index (0000) = "FL00120150141"