13 Replies Latest reply on Oct 26, 2017 10:54 AM by pierrep52392313

    Scan a document for collecting the values of some fields

    pierrep52392313 Level 1

      I created a document (I don't know how to upload a pdf, therefore you can access a sample via Dropbox : https://www.dropbox.com/s/fni2eur4t1w48qa/Data_collecting%20.pdf?dl=0) of several pages and I need to extract the value of a field which can appear on some of the pages.

       

      These fields are named:

      Source.0

      Source.1

      Source.2

      etc.

       

      Page one can start with the field Source.2

      the following page can be free of such a field

      The field Source.8 may appear on page 3

      etc.

       

      I am trying to scan each page for finding a field starting with "Source." and if found, to copy its value to another field starting with "Result." but with the same index :

      Result.3 value = Source.2 value

      Result.10 value = Source.10 value

      etc.

       

      Please pay attention : the fields "Source." contain fixed references and the displayed pages are issued from templates. Therefore, I need to know which reference fields appear ont the displayed pages, and then capture their value. The list of "Result" will show part of the fields with a value, and the others must stay empty.

       

       

      Here below is the beginning of my story... but I miss too much knowledge to continue...

       

        

      Can someone help me to finalize it ?

      Many thanks in advance.

       

      *********************************************************************

      ATTEMPT to display the value in app.alert (!!! infinite loop !!!

      **********************************************************************

      var
      nameField="";

       

      for (var a
      = 0; a < this.numPages; a++) {

       

      for (var i
      = 0; i < this.numFields; i++) {

                    var
      nameField=this.getNthFieldName(i);

                    var f = this.getField(nameField);

                    var str=nameField;

                    var OK =
      str.indexOf("Source.");

                    if (OK > -1) {

                                  app.alert(this.getField(nameField).value);

                                                 //break;

                                  }

                    }

      }