Knowledge Base

Article ID: 1256 | Category: Project Setup | Type: How To | Last Modified: 8/27/2015

How to split the flow of pages into batches by a barcode?

Description

A constant stream of pages from a scanner needs to be split into batches using barcodes by creating a new batch every time a page with a barcode is added.

Solution

Using barcodes to split batches

This is only possible with the help of scripts, since the Scanning Station's interface only allows splitting pages into documents within a batch. The following example (JScript) is triggered by the "After Page Added" event.

To create a script for this event, open the batch type settings, go to the "Scripts" tab and select the "After Page Added" event.

This script is run for every scanned page.

var batch = this.ScriptItems.Item(0).Parent;
var page = this.ScriptItems.Item(0);
if(batch.Children != null && batch.Children.Count > 1)
//Creates a new batch if the current batch isn't empty. For example, if a page with a barcode
//is placed into the batch, a new batch does not need to be created.
{
  if (FindPageBarcodes(page).Count > 0)
  //Checks if there are barcodes on the page 
  {
    var batchName = "";
    var batchType = this.CurrentBatchType;     //creates a new batch after the current one
    var nBatch = AddBatch(batch, batchName, batchType); 
    page.Move(nBatch, true); //moves a page to the new batch
  }
} 

476 people think this is helpful.
Was this information helpful to you?