Searching specific MDB modules for UnitBatches

Discussion created by vwitzel on Jun 19, 2013
Latest reply on Jun 26, 2013 by vwitzel

Hi all,


I am trying to search for all UnitBatches within a particular level within the MDB. Looking at the "PI SDK Programming Reference" file available on vCampus, I see that there are a two different UnitBatch search methods available: PIModuleDB.PIUnitBatchSearch and PIModule.PIUnitBatchSearch. If I understand their descriptions correctly, the method I would want to use is the latter. However, when I tried using either of the below approaches to find UnitBatches below the test module I created ("ModuleTest") within my MDB, the resulting PIUnitBatchList appears to be empty.

Dim srv As Server
Dim ubl As PIUnitBatchList
Dim module As PIModule

Set srv = Servers("[machine name]")
If Not srv.Connected Then Exit Sub


Set module = srv.PIModuleDB.PIModules.Item("ModuleTest")
Set ubl = module.PIUnitBatchSearch("*-20y", "*", , , , , asy)


Set ubl = srv.PIModuleDB.PIModules.Item("ModuleTest").PIUnitBatchSearch("*-20y", "*", , , , , asy)

 Appreciate any insights you can share :)