1.877.833.1202

Using Multiple Barcodes with Manage Imports

This article is for legacy users of Quickscan Pro (QSP) as it is no longer available to purchase has the facility to scan multiple barcodes in a single zone, but only the first one can be assigned to an index. However, there is an option to export all barcodes that were scanned. Unfortunately each barcode is exported as an individual field with the same name in the XML file and Manage Imports has no way to import those fields. If there was a method to combine all the barcodes into a single field, FileHold could store the value in a text field. If each barcode was separated by white space then the FileHold search could find each barcode individually even though they are in one field. This article uses the XSL transformation feature of QSP to combine all the barcodes into a single field separated by a space.

IMPORTANT: This article assumes the reader is familiar with XML, XSLT, and XPATH. This information is provided AS IS and is not covered by FileCare support. If you would like to deploy a solution like this, FileHold Professional Services are available to assist you.

For the purpose of this example we will assume we have a single page document containing an invoice number and four barcodes with courier tracking numbers. We will store this document in FileHold using a document schema called Invoice with two metadata fields: invoice number and tracking numbers. We will separate the tracking numbers from each other with a space. This will allow us to easily search for any individual tracking number.

Invoice schema metadata fields

Our invoice has four barcodes and an invoice number.

sample invoice

Indexing has been setup to provide zonal OCR for the invoice number.

indexer first barcode field

A single barcode field called First Barcode has been defined in order to activate barcode scanning, but it will not be used with the output.

indexer first barcode configuration

After indexing the document the invoice field will be filled as will the first barcode field. The barcode field displayed is not important in this process. It is only their to ensure all the barcodes on the page were captured by QSP in the background.

indexer results

Now we will export an XML file called BatchExport.xml with the contents for import into FileHold manage imports.

export output

We will specify that the output will include the filename from the page values as needed by manage imports. We will add the invoice field from the indexer and we will also include the barcodes by checking the barcodes option and entering a value of 4.

export fields

When we export the batch the following XML file will be produced.

<Batch>
    <Page>
        <Field>
            <Name>File Name</Name>
            <Value>C:\Scan\0001_Sample_Invoice.jpg</Value>
        </Field>
        <Field>
            <Name>Invoice</Name>
            <Value>06888</Value>
        </Field>
        <Field>
            <Name>Barcode</Name>
            <Value>1Z6697140302241269</Value>
            <Type>4</Type>
            <Left>202</Left>
            <Top>56</Top>
            <Width>313</Width>
            <Height>77</Height>
        </Field>
        <Field>
            <Name>Barcode</Name>
            <Value>1Z97V47Y6881583038</Value>
            <Type>4</Type>
            <Left>23</Left>
            <Top>604</Top>
            <Width>379</Width>
            <Height>77</Height>
        </Field>
        <Field>
            <Name>Barcode</Name>
            <Value>1Z5094122004560551</Value>
            <Type>4</Type>
            <Left>17</Left>
            <Top>716</Top>
            <Width>313</Width>
            <Height>77</Height>
        </Field>
        <Field>
            <Name>Barcode</Name>
            <Value>1Z7VV8103593909305</Value>
            <Type>4</Type>
            <Left>20</Left>
            <Top>821</Top>
            <Width>401</Width>
            <Height>77</Height>
        </Field>
    </Page>
</Batch>

Unfortunately this file cannot be used directly by FileHold manage imports as there can only be one field for each field name. In this file there are four barcode fields all with the same field name. The solution is to apply some post processing to the file before it gets to manage imports. QSP provides a built-in XSL processor. Using XSLT we can define post processing that will convert our XML file to a format that is suited to manage imports.

TIP: This is not a tutorial on how to create XSL, but rather an example of how to use it with QSP and FileHold. A wealth of information on this powerful standard tool is available on the web.

Below is an example of the XSL that will be used to convert the original XML document in to the new XML document. The code below will process the filename, invoice field, and any number of barcodes that may be present. Small changes would be needed to add additional fields.

	<?xml version="1.0" encoding="utf-8"?>
	<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
	  <xsl:output method="xml" indent="yes"/>
	  <xsl:template match="/">
	    <Batch>
	    <xsl:for-each select="/Batch/Page">
	      <Page>
	        <xsl:for-each select="Field">
	          <xsl:choose>
	            <!-- File Name will be required in every file for Manage Imports -->
	            <xsl:when test="Name='File Name'">
	              <xsl:copy-of select="."></xsl:copy-of>
	            </xsl:when>
	            <xsl:when test="Name='Invoice'">
	              <xsl:copy-of select="."></xsl:copy-of>
	            </xsl:when>
	            <!-- Repeat the above as for Invoice for any indexes you would like the output -->
	          </xsl:choose>
	        </xsl:for-each>
	          <Field>
	            <Name>Barcodes</Name>
	            <Value>
	              <xsl:call-template name="ConcatBarcodes"/>
	            </Value>
	          </Field>
	      </Page>      
	    </xsl:for-each>
	    </Batch>
	  </xsl:template>
	  <xsl:template name="ConcatBarcodes">
	    <xsl:for-each select="Field">
	      <xsl:choose>
	        <xsl:when test="Name='Barcode' and Value!=''">
	          <xsl:value-of select="./Value"/>
	          <xsl:text> </xsl:text>
	        </xsl:when>
	      </xsl:choose>
	    </xsl:for-each>
	  </xsl:template>   
	</xsl:stylesheet>

We can use this XSL with our output definition to complete the picture.

export output xslt

Exporting with the XSL transformation produces the following XML that can be used with manage imports.

	<?xml version="1.0" encoding="UTF-16"?>
	<Batch>
	    <Page>
	        <Field>
	            <Name>File Name</Name><Value>C:\Scan\0001_Sample_Invoice.jpg</Value></Field>
	        <Field>
	            <Name>Invoice</Name>
	            <Value>06888</Value>
	        </Field>
	        <Field>
	            <Name>Barcodes</Name>
	            <Value>1Z6697140302241269 1Z97V47Y6881583038 1Z5094122004560551 1Z7VV8103593909305 </Value>
	        </Field>
	    </Page>
	</Batch>

Each barcode value is separated by a space in the resulting XML. These will be imported to a single text field in FileHold. The space will allow the full text search to create an independent index for each barcode value and make searching easy. We setup a manage import definition to map our XML field to our document schema and import the document.

invoicoe manage imports definition example

After running the import the document is ready for searching on the tracking numbers.

invoice metadata panel example

More information on importing documents and using QSP is available at the links below.

Manage Imports Tool

Document Scanning Software Best Practices