Using Barcode Data in Processes

Using the Barcoded Forms service in processes, you can extract barcode data from scanned images (TIF or PDF files), convert the data to XML format, and use it in the processes.

This Quick Start is most useful if you are already familiar with the Barcoded Forms service. For more information about this service, see LiveCycle ES2.5 Services .

For example, a university’s business process uses a barcoded form that students use to change either their name or their status for the school records. Two barcodes on the form capture the information that students enter on the form:

  • One barcode captures information from a drop-down menu that the student uses to indicate whether they are changing their name or their status.

  • The other barcode captures the details about their name or status change.

The Barcoded Forms service is used to read the barcode and process the information that it contains.

The following illustration shows the process diagram that is used to read the barcode and process the data. The data is processed differently depending on whether the student is changing their name or their status. The routes that follow the Extract Content operation have conditions that determine how to process the data accordingly.

The Decode Form operation reads the barcodes and saves the data as XML. The data includes metadata about the barcodes as well as the form data. The form data is in delimited-text format contained in content elements.

The following XML is an example of the output that the Decode Form operation produces. The data from each barcode is contained in separate barcode elements:

  • The barcode element with the id attribute value of 1 represents the barcode that contains the details about the name or status change.

  • The barcode element with the id attribute value of 2 represents the barcode that contains the value of the drop-down menu that indicates whether a name or status change has been submitted.

    <?xml version="1.0" encoding="UTF-8"?> 
    <xb:scanned_image 
                            xmlns:xb="http://decoder.barcodedforms.adobe.com/xmlbeans" 
                            path="tiff" version="1.0"> 
        <xb:decode> 
            <xb:date>2007-07-25T11:48:22.639-04:00</xb:date> 
            <xb:host_name>Win2K3-LC8</xb:host_name> 
            <xb:status type="success"> 
            <xb:message/> 
            </xb:status> 
        </xb:decode> 
        <xb:barcode id="1"> 
            <xb:header symbology="pdf417"> 
                <xb:location page_no="1"> 
                    <xb:coordinates> 
                        <xb:point x="0.119526625" y="0.60945123"/> 
                        <xb:point x="0.44457594" y="0.60945123"/> 
                        <xb:point x="0.44457594" y="0.78445125"/> 
                        <xb:point x="0.119526625" y="0.78445125"/> 
                    </xb:coordinates> 
                </xb:location> 
            </xb:header> 
            <xb:body> 
                <xb:content encoding="utf-8">t_SID t_FirstName t_MiddleName 
                                                                t_LastName t_nFirstName t_nMiddleName 
                                                                t_nLastName &#13;90210 Patti Y Penne 
                                                                Patti P Prosciutto  
                </xb:content> 
            </xb:body> 
        </xb:barcode> 
        <xb:barcode id="2"> 
            <xb:header symbology="pdf417"> 
                <xb:location page_no="1"> 
                    <xb:coordinates> 
                        <xb:point x="0.119526625" y="0.825"/> 
                        <xb:point x="0.44457594" y="0.825"/> 
                        <xb:point x="0.44457594" y="0.9167683"/> 
                        <xb:point x="0.119526625" y="0.9167683"/> 
                    </xb:coordinates> 
                </xb:location> 
            </xb:header> 
            <xb:body> 
                <xb:content encoding="utf-8">t_FormType t_FormVersion 
                                                                &#13;ChangeName 20061128  
                </xb:content> 
            </xb:body> 
        </xb:barcode> 
    </xb:scanned_image>

Because the form data is delimited text, it is difficult to parse and extract information. Therefore, the Extract Content operation is used to parse and save the data in XML format. In XML format, XPath expressions can be used to access specific items of data.

The following XML is an example of the output that the Extract Content operation produces for the first barcode on the form ( id = 1 ).

    <?xml version="1.0" encoding="UTF-8"?> 
    <xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/"  
                    xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"> 
        <xfa:datasets> 
            <xfa:data> 
                <form1> 
                    <t_SID>90210</t_SID> 
                    <t_FirstName>Patti</t_FirstName> 
                    <t_MiddleName>Y</t_MiddleName> 
                    <t_LastName>Penne</t_LastName> 
                    <t_nFirstName>Patti</t_nFirstName> 
                    <t_nMiddleName>P</t_nMiddleName> 
                    <t_nLastName>Prosciutto</t_nLastName> 
                </form1> 
            </xfa:data> 
        </xfa:datasets> 
    </xdp:xdp>

The following XML is an example of the output that the Extract Content operation produces for the second barcode on the form ( id = 2 ).

    <?xml version="1.0" encoding="UTF-8"?> 
    <xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/" 
                    xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"> 
        <xfa:datasets> 
            <xfa:data> 
                <form1> 
                    <t_FormType>ChangeName</t_FormType> 
                    <t_FormVersion>20061128 </t_FormVersion> 
                </form1> 
            </xfa:data> 
        </xfa:datasets> 
    </xdp:xdp>

The routes that follow the Extract Content operation include conditions that determine the next operation to execute. The conditions use the content of the t_FormType element from the second barcode to determine which route is valid. The content of this element represents the option that the student selected on the form for changing their name or their status. Because the data is in XML format, the content can be retrieved using XPath expressions. For example, the following XPath expression retrieves the content of the t_FormType element:

/process_data/contentList[2]/xdp:xdp/xfa:datasets/xfa:data/form1/t_FormType
contentList is a list variable that contains XML data. In this example, the variable stores the output of the Extract Content operation.

Prerequisites

To use the Decode operation, the barcode must be available to the process at run time. The barcode can be provided as an image file (TIF format) or the filled PDF file that contains the barcode can be provided (flattened PDF). A PDF document that was created from a scanned image of the barcode can also be used.

The Barcoded Forms service supports the following TIF formats:

  • binary

  • grayscale

  • RGB color

  • LZW compressed

  • JPEG compressed

  • CCITT Group 3 and Group 4 compressed

For the example process, a watched folder endpoint can be created for invoking the process. The file that contains the barcode is copied to the watched folder to create a process instance.

Configuration

The Decode operation in the example process is an instance of the Decode operation that the Barcoded Forms service provides. The operation requires the following data items as input:

  • A document value that represents a PDF document or a TIF image that contains one or more barcodes to decode.

    When a watched folder is used as the process endpoint, the file that is provided is automatically converted to a document value.

  • The symbology used for the barcode.

    The example process uses PDF417 barcodes.

The results of the Decode operation are provided as XML data. An xml variable must be created and used to store the data.

The Extract Content operation in the example process is an instance of the Extract to XML operation that the Barcoded Forms service provides. The operation requires the following data items as input:

  • An org.w3c.dom.Document value that represents the XML document that the Decode operation produces.

    The xml variable that stores the output of the Decode operation in the example process can be used as this input value.

  • Information about the delimiters that are used in the barcode data.

    In the example barcode data, the Tab character is used to separate field values and the carriage return character is used to separate lines of field names and field values.

The results of the Extract to XML operation are provided as a list value that contains xml values. Each item in the list represents the data from each barcode that was processed.

Other considerations

Form developers should select a simple format for delimiting barcode data to maximize the compatibility of the data with the Convert to XML operation. For example, the form design features of Workbench allows you to encode barcodes with each field name on a single line and the field value on the following line, using tabs to delimit the fields. This format enables process developers to use the default value of Tab for the field delimiter in the Extract to XML operation.

When you add the Decode operation to a process diagram, the operation catches an exception event by default. You can use the event catch to perform alternative activities if an error occurs when the operation executes.

// Ethnio survey code removed