2 Replies Latest reply on Apr 20, 2014 6:57 PM by kokolopr

    SDK Programming in VBA


      Hello friends,




      I want to list down all the tags available from a server in a list without usng inbuilt Tagsearch of PI also want to include wild character functionality can some one guide me.




      Thanks In advance

        • Re: SDK Programming in VBA

          Hello Siddhartha,


          Please look into the PI SDK Help file (%PIHOME%\Help\pisdk.chm) for the GetPoints, Server method. There's an example (Server Example 2) which is in VB6 that is pretty similar to VBA.


          I am just curious. What do you like to do with this tag list in ProcessBook?

            • Re: SDK Programming in VBA

              Hello Siddhartha,


              You can use SQL as below for wild card search


              Dim strPISQL As New OleDbCommand


                         Dim PIValue As String = ""


                         PISource = "Provider=PIOLEDB.1;User ID=;Password=;Data Source=" & lbl_PIServer.Text & ";Integrated Security=SSPI;Persist Security Info=True;"


                         Dim PIConn As New OleDbConnection(PISource)


                         If PITag_txt.Text.Trim <> "" Then


                             Dim strSearch As String = PITag_txt.Text


                             strSearch = strSearch.Replace("*", "%")


                             strSearch = strSearch.Replace("?", "_")


                             strSQL = "SELECT TAG, DESCRIPTOR, ENGUNITS FROM PIPOINT WHERE TAG LIKE '" & strSearch & "'"


                             If sortPI_lbl.Text <> "" Then


                                 strSQL = strSQL & sortPI_lbl.Text


                             End If


                             Dim ad As New OleDbDataAdapter(strSQL, PIConn)


                             Dim DTable As New DataTable






                                 If DTable.Rows.Count < 20 Then


                                     Dim i As Integer


                                     For i = 1 To 20 - DTable.Rows.Count


                                         Dim row As DataRow = DTable.NewRow






                                 End If


                                 If DTable.Rows.Count = 20 Then


                                     Dim unt As System.Web.UI.WebControls.Unit = New System.Web.UI.WebControls.Unit(346)


                                     dgPI.Width = unt




                                     Dim unt As System.Web.UI.WebControls.Unit = New System.Web.UI.WebControls.Unit(329)


                                     dgPI.Width = unt


                                 End If


                                 dgPI.DataSource = DTable




                             Catch ex As Exception


                                 alert("Sorry, this search can not be performed.")


                             End Try