kpotter

Error reading string-type Attributes when they are Table-Lookups

Discussion created by kpotter on Aug 30, 2013
Latest reply on Sep 2, 2013 by kpotter

The weird part is that I did not used to have this problem, but it just started happening.

 

The following reads from a String-type attribute: 

 

Dim MyAttribute As OSIsoft.AF.Asset.AFAttribute

 

‘MyAttribute is assigned properly

 

String1 = MyAttribute.GetValue.ToString

 

 

 

When the attribute is a Table-Lookup (although I see the proper value in AF), it returns:

 

“System.InvalidCastException: Specified cast is not valid.”

 

 Here's an exaple of one of the Table Lookup calls:

 

SELECT AmbTemp FROM [Table2] WHERE PlantName = '%..\..\..\Element%'

 

This lookup is working fine in AF, but the code returns an error.

 

This just began occurring on a site where they have:

 

PI System Explorer 2010 R3

 

AF SDK Version 2.4.0.4431

 

Any help is appreciated.

Outcomes