PIUnitBatchSearch Method (PIModuleDB object)

             

Searches for PIUnitBatch's.

 

Syntax

object.PIUnitBatchSearch varSearchStartTime, varSearchEndTime,bstrModuleNameMask, bstrBatchIDMask, bstrProductMask, bstrProcedureMask, bstrSubBatchMask, [AsynchStatus], [varUnitBatchUniqueID], [varModuleUniqueID]

The PIUnitBatchSearch method syntax has these parts:

Part

Description

object

An object expression that evaluates to a PIModuleDB object.

varSearchStart

A VARIANT containing the search start time. The VARIANT may be a PITime, DATE, String, or numeric. Interpretation of DATE, strings and numerics is consistent with PITime's interpretation. NOTE:  The minimum start time passed should be PITime.UTCSeconds = 1. 

varSearchEnd

A VARIANT containing the search end time. The VARIANT may be a PITime, DATE, String, or numeric. Interpretation of DATE, strings and numerics is consistent with PITime's interpretation.

bstrModuleNameMask

Wildcard string of a PIModule name to match. Defaults to “*”.

bstrBatchIDMask

Wildcard string of BatchID to match. Defaults to “*”.

bstrProductMask

Wildcard string of Product to match. Defaults to “*”.

bstrProcedureMask

Wildcard string of ProcedureName to match. Defaults to “*”.

bstrSubBatchMask

Wildcard string of SubBatch name to match. Defaults to “*”.

AsynchStatus

Optional asynchronous status object (PIAsyncStatus).

varUnitBatchUniqueID

Optional unique id of PIUnitBatch. Used to find specific unit batch. Overrides all masks.

varModuleUniqueID

Optional unique id of PIModule. Used to find unit batches created on a specific module. Overrides the module name mask.

 

Remarks

Returns a PIUnitBatchList of matching PIUnitBatch objects. PIUnitBatch objects have a primary index on time and PIModule; specifying small ranges of time and PIModule will result in fastest performance.

 

Any PIUnitBatch which has an EndTime on or after the search start and a start time on or before search end matches the search time criteria. Running PIUnitBatch's (PIUnitBatch's with no end time set) always match search times which include current time.

 

All five masks default to the wildcard character "*". Therefore just specifying search start and end returns all PIUnitBatch objects over that time range.

 

The pAsynchStatus argument is used for performing asynchronous calls. If this argument is passed, the method returns immediately with an empty list. This list is protected against access (an error of pseASYNCHMODEERR will be returned) until the call is complete.

 

The argument varUnitBatchUniqueID is used to retrieve a specific PIUnitBatch object. This argument, if set, overrides the search masks including the start and end time. The search start and end time are used as a hint for where to find the object, but it is possible that the matching object may have start and/or end times outside of the time range of the search.

 

If no PIUnitBatch's are found that match the search criteria, an empty list is returned.

 

Trappable Errors

In addition to generic errors (such as Out of Memory), the following errors may occur:

Error

Description

pseNOGENSERVER

The parent underlying generic server object could not be retrieved.

 

Enabling Operational Intelligence