4 Replies Latest reply on Mar 2, 2015 5:16 PM by bshang

    How to configure the Element in Value type of AF attribute

    hsuzuki

      I can choose the Element in Value type of AF attribute. I'd like to know how to use the Element in Value type of AF attribute.

       

      Hiroyuki

       

       

        • Re: How to configure the Element in Value type of AF attribute
          andreas

          if you want to create it:

          Dim myPISystem As OSIsoft.AF.PISystem
          Dim myPISystems AsNew OSIsoft.AF.PISystems
          Dim myAFDatabase As OSIsoft.AF.AFDatabase
          Dim myAFElement01 As OSIsoft.AF.Asset.AFElement
          Dim myAFElement02 As OSIsoft.AF.Asset.AFElement
          Dim myAFElement03 As OSIsoft.AF.Asset.AFElement

          myPISystem = myPISystems.DefaultPISystem
          myAFDatabase = myPISystem.Databases.Item("vCampus")

          myAFElement01 = myAFDatabase.Elements.Add("MyRootElement")
          myAFElement02 = myAFElement01.Elements.Add("MyChild")
          myAFElement03 = myAFElement02.Elements.Add("MyGrandChild")

          Dim myAFAttribute01 As OSIsoft.AF.Asset.AFAttribute
          myAFAttribute01 = myAFElement01.Attributes.Add("MyAttribute")

          Dim myAFValue AsNew OSIsoft.AF.Asset.AFValue
          myAFValue.Value = myAFElement02
          myAFAttribute01.SetValue(myAFValue)

          if you want to use it:

          Dim myPISystem As OSIsoft.AF.PISystem
          Dim myPISystems AsNew OSIsoft.AF.PISystems
          Dim myAFDatabase As OSIsoft.AF.AFDatabase
          Dim myAFElement01 As OSIsoft.AF.Asset.AFElement
          Dim myAFElement02 As OSIsoft.AF.Asset.AFElement
          Dim myAFAttribute01 As OSIsoft.AF.Asset.AFAttribute
          Dim myAFValue01 As OSIsoft.AF.Asset.AFValue

          myPISystem = myPISystems.DefaultPISystem
          myAFDatabase = myPISystem.Databases.Item("vCampus")
          myAFElement01 = myAFDatabase.Elements.Item("MyRootElement")
          myAFAttribute01 = myAFElement01.Attributes.Item("MyAttribute")'
          myAFValue01 = myAFAttribute01.GetValue()
          myAFElement02 = myAFValue01.Value