GALLON

AFSDK how to check if the PIPoint as AFAttribute is already created or not

Discussion created by GALLON on May 7, 2014
Latest reply on May 7, 2014 by GALLON

 Hi,

 

I'm creating AFElements and their related PIPoints by using the CreateConfig function (see the code below).

 

I do not find a nice way to check if the PIPoint as AFAttribute is already created or not... Every method I try, I receive an Exception. I would like to avoid try catching for that 

 

Any idea?

 
           foreach (AFAttribute curAttribute in myElement.Attributes)
            {
                string an = curAttribute.Name;
                if (curAttribute.DataReference != null && curAttribute.DataReferencePlugIn == curAttribute.PISystem.DataReferencePlugIns["PI Point"])
                {
                    string type = curAttribute.Type.Name;
                    AFElementContainer ac = AFElementContainer.findIndexByAttributeName(curAttribute.Name, attributeConfigNames);
                    
                    curAttribute.DataReferencePlugIn = AFDataReference.GetPIPointDataReference(myPISystem);
                    curAttribute.ConfigString = String.Format(@"\\%Server%\{0}_{1};ptclassname=classic;pointtype=""{2}"";descriptor=""{3}"";shutdown=0;datasecurity=etc.....", curAttribute, afelementSuffixName, type, curAttribute.Description);
                    curAttribute.DataReference.CreateConfig();
                }
...

 

 

Thanks,

 

Mahyar SEPEHR

Outcomes