Table of Contents
1. Introduction
Flow returns a null instead of an Enumeration ordinal value for a retrieved event attribute when a historian returns a bad quality tag. This technote walks through filtering out invalid data using a custom expression for a retrieved event attribute segment.
2. Solution
- Open the enumeration.
- Add a new ordinal that represents the invalid data.
3. Open the event and navigate to the retrieved attribute’s retrieval properties.
4. Change the Type to Custom Expression.
5. Open the Custom Expression Editor and add the tag/s from the Namespace to the Items list.
6. Select Row-based Lookup under Event Attribute from the Example Menu.
7. The expression automatically populates in the editor with the tag where applicable.
8. Adjust the ternary condition so that you compare the tag value to the expected enumeration ordinal.
9. Add a case for every enumeration ordinal if necessary. Use MS Excel to generate a list of the string results where the number of ordinals is excessive.
NB: An Event Attribute has a data type of String, while the Enumeration Ordinal is or type Integer. Flow automatically handles the two types internally when comparing the tag value to the ordinal.
10. Validate the expression, deploy the event, and backfill the attribute. The event attribute values are now populated, and the enumeration replaces null/invalid data.