Progammatically changing Search criteria in PIBatch

Discussion created by Chris.Wiseman on Mar 12, 2009
Latest reply on Mar 24, 2009 by dhollebeek

Im attempting to progammatically update the PIBatch Search criteria on an event.  Initially when there is nothing configured in the PIUnitBatch search the code below works.  Once the event happens once and there is a unit and product associated with the PIBatch it the code no longer updates the search criteria. 


Any suggestions?


Here is the code below:

Private Sub UpdateBatchSearch()

  Dim theUnit As String

  theUnit = theClass.getUnitPath(LocationBox.Value)

  Dim y As New PIBatchSearch.SearchCriteria

  Set y = BatchGroup1.SearchCriteria

  y.BatchItemCriteria.AttributeType(0) = pibvUAttrBatchID
  y.BatchItemCriteria.AttributeMasksStr(0) = theUnit

  y.BatchItemCriteria.AttributeType(1) = pibvUAttrBatchID
  y.BatchItemCriteria.AttributeMasksStr(1) = ProductBox.Value

  BatchGroup1.SetSearchCriteria y, True

End Sub