8 Replies Latest reply on Feb 10, 2016 10:40 PM by statsoft

    Is there a UI control for selecting a batch id?

    statsoft

      Is there a UI control for selecting a batch id?  I am using the PI-SDK COM object.  Is there a convenient way to pull all the tags associated with a batch id and also get the start/end times of the batch?

        • Re: Is there a UI control for selecting a batch id?
          Dan Fishman

          I know there is a PIBatchViewProgramming.chm I found on my computer under PIPC\Help that discuss outlines the batch dialogs. Not sure if you have seen this before. Of course, the AF SDK dialog for Event Frames I know quite a bit better.  There is a fairly straightforward PI SDK method PIBatchSearch for searching batches. 

            • Re: Is there a UI control for selecting a batch id?
              statsoft

              Neither on my server or a local SDK installation do I see that file.  Did yours come from the PI-SDK installation or server?  What version of the server are you running?

                • Re: Is there a UI control for selecting a batch id?
                  Dan Fishman

                  I believe it might have came from the Batchview installation as they are the control used in BatchView. I found it on one of my client boxes I setup about 3 years ago.

                   

                  Dan

                    • Re: Is there a UI control for selecting a batch id?
                      statsoft

                      The following code, which comes straight from the BatchDB, produces an error when PIBatchSearch is attempted

                       

                      '#Reference {CB14968B-C3CA-11D3-BDBF-00C04F779EB2}#1.0#0#C:\Program Files (x86)\PIPC\pisdk\PITimeServer.dll#PITimeServer 1.0 Type Library#PITimeServer
                      '#Reference {7DABD445-40A7-11D4-BDEA-00C04F779EB2}#1.0#0#C:\Program Files (x86)\PIPC\pisdk\PISDKParse.dll#PISDKParse 1.0 Type Library#PISDKParse
                      '#Reference {76A44786-EBC8-11D3-BDC5-00C04F779EB2}#1.0#0#C:\Program Files (x86)\PIPC\pisdk\PISDKCommon.dll#PISDKCommon 1.0 Type Library#PISDKCommon
                      '#Reference {2996CF15-0C79-11D3-81B7-006097DFAC16}#10.8#0#C:\Program Files (x86)\PIPC\pisdk\PISDKDlg.dll#PI-SDK Dialogs#PISDKDlg
                      '#Reference {FBB0E3AD-0D46-11D3-81B7-006097DFAC16}#b.2#0#C:\Program Files (x86)\PIPC\pisdk\PISDKCtl.ocx#PI-SDK Control#PISDKCtl
                      '#Reference {0EE075CE-8C31-11D1-BD73-0060B0290178}#1.1#0#C:\Program Files (x86)\PIPC\pisdk\pisdk.dll#PISDK 1.3 Type Library#PISDK
                      '#Reference {BE35B7EB-0D00-44D8-B3A5-0727DF5AD7C1}#1.0#0#C:\VS2013\Current\Debug-Win32\dictionary.dll#StatSoft STATISTICA Dictionary Library
                      '#Reference {C9E29001-3D45-11D4-9FF4-00C04FA0D540}#1.0#0#C:\VS2013\Current\Debug-Win32\STL_MGRA.dll#STATISTICA Graphics Type Library#STATISTICAGraphics
                      Option Base 1

                      Sub Main

                      Dim PIServer As PISDK.Server
                      Dim BatchDB As PISDK.PIBatchDB
                      Dim BatchList As PISDK.PIBatchList
                      Dim Batch As PISDK.PIBatch
                      Dim SearchStart As New PITime
                      Dim SearchEnd As New PITime

                      Set PIServer = PISDK.Servers.Item("PIServer32.tulsa.statsoft.com")

                      Set BatchDB = PIServer.PIBatchDB

                      SearchEnd.SetToCurrent
                          SearchStart.UTCSeconds = SearchEnd - 3600#

                      Set BatchList = BatchDB.PIBatchSearch(SearchStart,SearchEnd)

                      Dim UnitBatches As PIUnitBatches
                      Dim UnitBatch As PIUnitBatch
                      For Each Batch In BatchList
                        For Each UnitBatch In Batch.PIUnitBatches
                        Next UnitBatch
                      Next Batch

                      End Sub

                      Untitled.png

                      Any ideas why an exception is being thrown?

                • Re: Is there a UI control for selecting a batch id?
                  gachen

                  Hi statsoft,

                   

                  As far as I know, there is no ready-made control or UI for searching for batches. However, it shouldn't be too hard to get this functionality from a little PISDK code. To search for the batch by ID, you can use the PIBatchSearch method. This will return a PIBatchList, off of which you could get the start and end times from the individual PIBatch items in the list. Getting all the points associated with a batch might require iterating a little bit. The batch should have associated unit batches, which you can get with the PIUnitBatches property of each PIBatch. Then for each PIUnitBatch, there is a PIUnit property, which should further have a PIAliases property, which has a DataSource property. So I think the general logic would be something like this to get all the points:

                   

                  for each PIUnitBatch in PIBatch.PIUnitBatches
                       for each PIAlias in PIUnitBatch.PIUnit.PIAliases
                            BatchTagsList.Add(PIAlias.DataSource)
                  
                  1 of 1 people found this helpful