Menu
Index

Merging Documents With the Same Barcode Value

Only available starting on v1.0.1.87
 
 
It is possible to create a function that will merge documents with the same value on a specific field inside the same batch. For this example we will use the Barcode Read field:
 
'Get current batch
Set Batch=ChronoApp.GetCurrentBatch
'Get document count
Dim NumDocs
NumDocs = Batch.GetDocCount
docpos_1 = 0
 
'Loop the Batch
Do Until docpos_1 >= NumDocs 
    Set document1 = Batch.GetDocument(docpos_1)
    barcode1=document1.get_field_value("Barcode Read")
    'Get next document and search for repeated values
    docpos_2=docpos_1+1
    Do Until docpos_2 >= NumDocs 'start from current document
          Set document2 = Batch.GetDocument(docpos_2)
          barcode2=document2.get_field_value("Barcode Read")
          If barcode1=barcode2 Then
              'If the barcode values match, merge the documents
              Batch.MergeDocuments docpos_1, docpos_2
              NumDocs=NumDocs-1
        Else
              docpos_2=docpos_2+1
          End If
    Loop
    docpos_1=docpos_1+1
Loop
 
This function can be used with a custom button or on the OnProcessFinish to mention a couple possibilities.
 
comments powered by Disqus