AFAttribute.GetValue() Error

Discussion created by HydroPowerGen on Sep 13, 2011
Latest reply on Sep 15, 2011 by andreas



I start using AF SDK.  I am trying to get the value from an attribute, which has a PI Point data reference.  Here is the code.


AFAttribute myAttr = AFAttribute.FindAttribute(@"\\GRPAPPDEV01\AiminTest\SwitchingCenter\Drum|GaugeHeight", afDB);


string val = myAttr.GetValue().Value.ToString();


"System.ApplicationException: Unable to create the PISDK. PI Data References will not function.\r\n   at OSIsoft.AF.Asset.DataReference.PIBaseDR.Initialize()\r\n   at OSIsoft.AF.Asset.DataReference.PIBaseDR.set_Attribute(AFAttribute value)\r\n   at OSIsoft.AF.Asset.DataReference.PIPointDR.set_Attribute(AFAttribute value)\r\n   at OSIsoft.AF.Asset.AFDataReference.Initialize(AFAttribute attribute, AFPlugIn plugIn, Guid id, String configString) in c:\\Dev\\AF\\AF 2.3\\Sources\\SDK\\Asset\\AFDataReference.cs:line 315\r\n   at OSIsoft.AF.AFPlugIn.CreateDataReferenceInstance(AFObject context, String configString) in c:\\Dev\\AF\\AF 2.3\\Sources\\SDK\\AFPlugIn.cs:line 641"


And in the Immediate Window when I typed in ?myAttr.GetValue(), I got this:


AFValue="Unable to create the PISDK. PI Data References will not function." UOM=null Timestamp={1/1/1970 12:00:00 AM} IsGood=false
    Annotated: false
    IsGood: false
    Questionable: false
    Status: Bad
    Substituted: false
    Timestamp: {1/1/1970 12:00:00 AM}
    UOM: null
    Value: {"Unable to create the PISDK. PI Data References will not function."}


Thanks for your help.