Vanco

With UpdateValue to write values to tag using its Alies

Discussion created by Vanco on Aug 22, 2014
Latest reply on Aug 26, 2014 by Vanco

Hi,

 

I am using the PISDK function UpdateValue to write values to tag (please see the code below). In order to implement the code on multiple units I would need to use the alias of the tag, but I am having difficulties making UpdateValue function working with alias. Could you give me some hints how can I accomplish this.

 

Thank you in advance for your help.

 

Regards,

 

Vancho

 

        Dim MyPISDK As New PISDK.PISDK

 

        Dim srv As PISDK.Server

 

        Dim LogSDK As PISDK.PIPoint

 

        Dim AlarmsSDK As PISDK.PIPoint

 

        Dim vals As New PISDK.PIValues, piVal As PISDK.PIValue

 

        Dim nvAtts As New NamedValues

 

        Dim valsA As New PISDK.PIValues, piValA As PISDK.PIValue

 

        Dim nvAttsA As New NamedValues

 

 

 

        srv = MyPISDK.Servers.DefaultServer

 

 

 

        LogSDK = srv.PIPoints("TagName1")

 

        AlarmsSDK = srv.PIPoints("TagName2")

 

        For i As Integer = 0 To 262

 

            If arrayTags(i).IsTrigger Then

 

                vals.ReadOnly = False

 

                piVal = vals.Add(ExeTime, arrayTags(i).Value + "/" + arrayTags(i).Desc(), nvAtts)

 

                vals.ReadOnly = True

 

                LogSDK.Data.UpdateValue(piVal, 0, DataMergeConstants.dmInsertDuplicates)

 

                If String.Equals(arrayTags(i).Value.ToString, "True") Then

 

                    valsA.ReadOnly = False

 

                    piValA = valsA.Add(ExeTime, arrayTags(i).Desc(), nvAttsA)

 

                    valsA.ReadOnly = True

 

                    AlarmsSDK.Data.UpdateValue(piValA, 0, DataMergeConstants.dmInsertDuplicates)

 

                End If

 

            End If

 

        Next

Outcomes