gajendra_konnur

PI event frame AF SDK : set attribute value

Discussion created by gajendra_konnur on Aug 7, 2012
Latest reply on Aug 8, 2012 by gajendra_konnur

I am trying to generate Event frame with specific template and by setting specific attributes values like below:

 

 

 

Its generating event frame with template, but it’s not setting the value for the attributes. anyone can help in the same?

 

 

 

       PISystems myPISystems = new PISystems();

 

          

 

           AFDatabase myDB = myPISystems["ctsinnvlvsap5"].Databases.DefaultDatabase;

 

           PISystem myPIsys= myPISystems["ctsinnvlvsap6"];

 

 

 

           AFElementTemplate template = myDB.ElementTemplates["Furnance"];

 

           OSIsoft.AF.UnitsOfMeasure.UOM uom;

 

           uom = myDB.UOMs["gram per liter"];

 

           

 

 

 

           template.AttributeTemplates["Density"].SetValue(100.0,uom);

 

       

 

 

 

 

 

 

 

            string efname="ef"+System.DateTime.Now;

 

            AFEventFrame ef=new AFEventFrame(myDB,efname,template);

 

            ef.CheckIn();

 

 

 

And also what if UOM for attribute template is none (see second fig)?Please let me know how to set the value for such attribute too .

 

 

0827.af.jpg

 

 

 

 

Outcomes