3 Replies Latest reply on Nov 1, 2016 10:22 PM by Mike Zboray

    Error while creating data reference from template using AF SDK

    natdavidson

      I've been trying to follow various posts on how to mimic the "Create or update Data reference" function in  PSE by using the AF SDK. I have elements organized into a hierarchy, with templates applied that have attributes which are PI Points, and the PI points are defined using the tag configuration scripts in PSE, but there are also some attributes that are just AF attributes and not tied to PI Tags. When I get to following code:

       

      foreach (AFAttribute myAttribute in myElement.Attributes)

      {

              myAttribute.DataReference.CreateConfig();

      }

       

      I get the error:

      An unhandled exception of type 'System.NullReferenceException' occurred in AFIntegratorAndSNMP.exe

      Additional information: Object reference not set to an instance of an object.

       

      Looking at the myAttribute variable when this error comes up, it has value of Attribute "+Configuration", which is an AF Attribute, not an attribute that is a PI tag. I think this is why i'm getting the error, so my question would be then, how can i make sure to only use the CreateConfig(); method on an attribute that is a reference to a PI tag?