ACE code is not working as expected- It is regarding addition  of our data to MDB and also to  ACE context to perform our custom calculation

Discussion created by on Jul 1, 2011
Latest reply on Jul 8, 2011 by

Kindly advise . This code is not able to add the MDB stuff to ACE context

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    Dim mySDK As New PISDK.PISDK
    Dim srv As Server

    Dim membrane_name As String
    membrane_name = membraneName.Text

    Dim train_name As String
    train_name = TrainName.Text
    Dim tag1 As String
    tag1 = Tag1Text.Text
    Dim tag2 As String
    tag2 = Tag2Text.Text
    Dim tag3 As String
    tag3 = Tag3Text.Text

    Dim myMod1 As PISDK.PIModule
    Dim myMod2 As PISDK.PIModule
    Dim myMod3 As PISDK.PIModule

    srv = mySDK.Servers("usnap3dpi90")

        ' Add "Meters" module to root
        myMod1 = srv.PIModuleDB.PIModules.Add("Nalco Membranes")
    Catch ex As Exception
        myMod1 = srv.PIModuleDB.PIModules("Nalco Membranes")
        MsgBox("Nalco Membranes already exists")
    End Try

        ' Add "Train1" module under the "Meters" module
        myMod2 = myMod1.PIModules.Add(membrane_name)
    Catch ex As Exception
        myMod2 = myMod1.PIModules(membrane_name)
        MsgBox(membrane_name + " " + "already exists")
    End Try

        ' Add "Train1" module under the "Meters" module
        myMod3 = myMod2.PIModules.Add(train_name)
    Catch ex As Exception
        myMod3 = myMod2.PIModules(train_name)
        MsgBox(train_name + " " + "already exists")
    End Try

    Dim pt1 As PISDK.PIPoint
    Dim pt2 As PISDK.PIPoint
    Dim pt3 As PISDK.PIPoint

    pt1 = srv.PIPoints(tag1)
    pt2 = srv.PIPoints(tag2)
    pt3 = srv.PIPoints(tag3)
        myMod3.PIAliases.Add("Tag1", pt1)
        myMod3.PIAliases.Add("Tag2", pt2)
        myMod3.PIAliases.Add("Tag3", pt3)
    Catch ex As Exception
        MsgBox("Aliases already exists")
    End Try

    Dim mdbFunc As New PIACEMDBFunctions
    Dim ScheduleInfo As New NamedValues
    Dim ContextPath As String
    ContextPath = "\\usnapedpi90\default\NoSQL\Test\\\usnapedpi90\Nalco Membranes\" + membrane_name + "\" + train_name
    ScheduleInfo.Add("Priority", 3)
    ScheduleInfo.Add("Type", 1)
    ScheduleInfo.Add("Latency", 15)
    ScheduleInfo.Add("Tag1", tag1)

        PIACEMDBFunctions.AddPIACEContextSchedule(ContextPath, ScheduleInfo)
     Catch ex As Exception
    End Try

End Sub