10 Replies Latest reply on Sep 6, 2007 6:09 AM by (ABello)

    Barcode: simple application, little problem

    Level 1
      Hi! I'm using LiveCycle ES Preview...

      I created a simple short live process in which there is a watched folder where i put jpg, tiff or flat pdf with more than one barcode.

      At the beginning of the short live process I use the Decode PDF 417 Component and I save the content of the barcodes in a document object.
      Then I use the extract to XML components and I have x output files as x are the barcode on the form. That is: 2 barcodes, two output files (that are the XML file with the datas).

      Now, if I want to write those datas in a DB on a single line, how can I do in order to capture data from this XML file and transferred them to a DB (possibly all done within the workbench)?

      Thanks,
      ABello
        • 1. Re: Barcode: simple application, little problem
          Jasmin Charbonneau Level 4
          You'll need to have a loop that reads all the data files and then "Execute SQL Statements" or "Call Stored Procedures" operation of the JDBC service under Foundation to execute it.

          Jasmin
          • 2. Re: Barcode: simple application, little problem
            Level 1
            OK Jasmin, but how can I do a loop in LiveCycle?

            Thanks,
            ABello
            • 3. Re: Barcode: simple application, little problem
              Jasmin Charbonneau Level 4
              I'm not sure why you would write it to the file system. You should have your XML in a variable at this time.

              When you use the ExtractToXML operation, it should give you a list of XML documents. This should contain all your XML content.

              Then add a SetValue operation to construct your SQL statement. After that, use the Execute SQL Statement operation to execute it. Then draw a route back to the SetValue and draw another line to another operation out of the loop.

              Now, put a condition on the route that goes back to the SetValue to make sure you only go there a certain number of time. If your list variable is called myList and you have created a counter variable initialized to 0, then you can use the following xpath to check the condition on that route: /process_data/@counter < get-collection-size(/process_data/myList).

              If you go back to the setValue operation don't forget to increment the value of the counter to make sure you'll exit the loop.

              That's how you make a loop.

              Let me know if it wasn't clear. It's kind of hard to explain.

              Jasmin
              • 4. Re: Barcode: simple application, little problem
                Level 1
                Jasmine, sorry but I don't understand...ExtractToXML returns an object array (outXMLDocs)...if I create a XML variable in which I store the outXMLDocs, the output that ExtractToXML returns is only the first barcode...the other are not considered. Maybe I'm wrong, but I did some tryings and this was the result.

                If I put a variable logger at the end of the process, I can see that if I use an object array I have two elements (that for now are written to file system as XML files), if I use a XML variable I have only the XML that corresponds to the first barcode, others seem to be ignored).

                I don't want to pass on file system, if it is possible I want to write directly the XML in the database as you suggested.

                Thanks for your support,
                ABello
                • 5. Re: Barcode: simple application, little problem
                  Level 1
                  The ExtractToXML returns a List. There will be one instance of the XML document for each barcode that is found by the decode service.

                  Keep in mind that you don't have to use the Extract to XML service, the decode service will return a single xml document with the all the barcode data.

                  The Extract to XML is only useful if you have used the default encoding method including the field names in your form design. In some cases the field names take up more space in the barcode than the data you are trying to capture so make sure you pay attention to your field name lengths or for the best capacity, include only data and parse the data yourself.
                  • 6. Re: Barcode: simple application, little problem
                    Jasmin Charbonneau Level 4
                    Like Lee mentioned, it returns a list. So just use the code I gave you earlier and get the XML that corresponds to the index you in. For example /process_data/myList[/process_data/@counter], where counter is an integer that contains the index your loop is at.

                    Jasmin
                    • 7. Re: Barcode: simple application, little problem
                      Level 1
                      Thank to Lee and Jasmine for trying to help me.<br /><br />Maybe, i think I can't explain the problem.<br /><br />Lee, I have to include the field name, so I need to use ExtractToXML.<br /><br />If I use only the Decode Components, in the outputXMLDocs I can find the following text:<br /><br /><xb:decode><br />        <xb:date>2007-09-06T13:13:23.437+02:00</xb:date><br />        <xb:host_name>alessioserver</xb:host_name><br />        <xb:status type="success"><br />            <xb:message/><br />        </xb:status><br />    </xb:decode><br />    <xb:barcode id="1"><br />        <xb:header symbology="pdf417"><br />            <xb:location page_no="1"><br />                <xb:coordinates><br />                    <xb:point x="0.14705883" y="0.39141414"/><br />                    <xb:point x="0.75490195" y="0.39141414"/><br />                    <xb:point x="0.75490195" y="0.67045456"/><br />                    <xb:point x="0.14705883" y="0.67045456"/><br />                </xb:coordinates><br />            </xb:location><br />        </xb:header><br />        <xb:body><br />            <xb:content encoding="utf-8">Label     TextField3     TextField4     &#13;32649b64-5eb5-41a3-8fa6-026 a5465056e     Mario     Scaccia     </xb:content><br />        </xb:body><br />    </xb:barcode><br />    <xb:barcode id="2"><br />        <xb:header symbology="pdf417"><br />            <xb:location page_no="1"><br />                <xb:coordinates><br />                    <xb:point x="0.14705883" y="0.09090909"/><br />                    <xb:point x="0.75490195" y="0.09090909"/><br />                    <xb:point x="0.75490195" y="0.35732323"/><br />                    <xb:point x="0.14705883" y="0.35732323"/><br />                </xb:coordinates><br />            </xb:location><br />        </xb:header><br />        <xb:body><br />            <xb:content encoding="utf-8">Label     TextField1     TextField2     &#13;45ac21ba-16a5-4dd8-a501-c2c 4ac7db565     Alessio     Giorgietti     </xb:content><br />        </xb:body><br />    </xb:barcode><br /></xb:scanned_image><br /><br />So, as you can easily see it's not so easy to parse this XML in order to put data in the Db directly.<br /><br />Then, If I use ExtractToXML component after the Decode component, so I obtain two file on the file system that are more "simple"<br /><br />the first:<br />  <?xml version="1.0" encoding="UTF-8" ?> <br />- <xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"><br />- <xfa:datasets><br />- <xfa:data><br />- <form1><br />  <Label>32649b64-5eb5-41a3-8fa6-026a5465056e</Label> <br />  <TextField3>Mario</TextField3> <br />  <TextField4>Scaccia</TextField4> <br />  </form1><br />  </xfa:data><br />  </xfa:datasets><br />  </xdp:xdp><br /><br />and the second<br /><br />  <?xml version="1.0" encoding="UTF-8" ?> <br />- <xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"><br />- <xfa:datasets><br />- <xfa:data><br />- <form1><br />  <Label>45ac21ba-16a5-4dd8-a501-c2c4ac7db565</Label> <br />  <TextField1>Alessio</TextField1> <br />  <TextField2>Giorgietti</TextField2> <br />  </form1><br />  </xfa:data><br />  </xfa:datasets><br />  </xdp:xdp><br /><br />In the variable logger, the only thing that refers to the final XML variable is<br /><br />/process_data/finalXML - List: java.util.ArrayList:       Number of elements :2<br />{<br />1:[#document: null]<br />2:[#document: null]<br />}<br /><br />Now, I hope that you understand that my problem is that I can't succeded in putting in a variable the clear XML...I can only put the clear XML on the file system as an output variable.<br /><br />Thanks for supporting,<br />ABello
                      • 8. Re: Barcode: simple application, little problem
                        Jasmin Charbonneau Level 4
                        How do you write them to the file system. Which variable are you using?

                        Jasmin
                        • 9. Re: Barcode: simple application, little problem
                          Level 1
                          In order to write them to the file system I'm using a list xml object and I set this as "Output" variable. Also, in the Endpoint manager page, I put %F.xml as the Output Parameter Mappings. In this way, in the result folder I find n xml files (assuming that in my document there are n barcodes).

                          Thank,
                          Alessio
                          • 10. Re: Barcode: simple application, little problem
                            Level 1
                            Okay Jasmine, thanks for your help!

                            I solved implementing the strategy you suggested and also through other workarounds.

                            One of the problem was that you can't use
                            /process_data/myList[/process_data/@counter]
                            but instead
                            /process_data/myList[/process_data/@counter + 1]

                            because it seems that it is not zero-based.

                            Thanks,
                            Alessio