5 Replies Latest reply on May 31, 2017 6:55 AM by Asle Frantzen

    Best way to locate the most recent timestamp of a (non-PI Data Reference) AF attribute with particular value (via AF SDK)

    TrentHuhn

      Apologies if this type of question has been asked before, as I was not able to locate any previous answers.

       

      What I'm attempting to do is to locate the most recent timestamp of an AF attribute (specifically, one with a data reference type of 'Table Lookup') at which the attribute equals a particular value. In my case, the attribute value type is a Boolean. I attempted to use an expression of the form "'\\AFSERVER\AF\Attribute\Path|AttributeName'=True" in conjunction with the AFCalculation.CalculateAtRecordedValues() method, but this returns the following error: "Expressions cannot use attributes with non-PI Data References in Attribute [...]". I also tried using the AFAttribute.Data.RecordedValues() method, but got the following error: "The configured data reference for 'Attribute 'StateCodeOffline' in Element 'XXX'' does not support filter expressions."

       

      Is there any way to evaluate the value of a non-PI Data Reference attribute? If so, what would be the best method to accomplish this?

       

      The attribute in question has a config string as follows:

      SELECT Offline FROM UnitDeviceStateCodes WHERE StateCode = @[Operating State] AND UnitDeviceType = @UnitDeviceType

       

      I am currently running AF SDK version 2.8.5.7759 on my local machine. Our AF server is running 2.7.5.7166.