Product FAQ > Data Sources > How can I use a Visual KPI function for a tag or expression if the data type changes dynamically?
When retrieving a value from a historian or database, the data source will sometimes return different data types based on the state of the system at that moment. For example, a tag value or expression normally returns a real number, but if an interface fails it might return “I/O Timeout” or some other text or enumerated value.
This causes the equation processor in Visual KPI to scratch its head. When a value changes type dynamically (from real to string for example) we had no real workaround for testing a value and then using the same value in an equation. Our equation processing engine wanted one or the other in any given expression. So we are introducing 4 new functions which will tolerate an expression of changing type:
These functions can be used in any Visual KPI Attribute where equations are allowed. Here’s an example from the real world: In the “InService” Attribute for a KPI:
This will return “True” if the tag value is greater than 1.5, and will return “False” if the value is less than or equal to 1.5 OR returns a non-numeric value such as “I/O Timeout.”
Here's an example:
|Old Equation||Value of tag||Result|
|<IF([tag]>1.5, True, False)>||50.0||True|
|"I/O Timeout"||Equation not processed; error message shown|
|New Equation||Value of tag||Result|
If you have questions or want help implementing this, please call us at +1.925.218.6983 or write to email@example.com.