Jump to content

Scribe: How to extract data from multiple fields?


WF7A
 Share

This topic is 1639 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Greetings:

I'm thinking about buying the Scribe plug-in to extract data from multiple fields in a .pdf form to insert into a FileMaker Pro file and am looking at the Demo Examples' page, Example Script.

Am I correct in assuming that all I have to do is for each field I want to import is list a variable for it under the #Get field name to retrieve from script parameter as well as under #Get the list?

Example: 

#Get field name to retrieve from script parameter

Set Variable [$apple; Value ( Get(ScriptParameter)]

Set Variable [$peach; Value ( Get(ScriptParameter)]

Set Variable [$orange; Value ( Get(ScriptParameter)]

...

#Get the list

Set Variable [$val; Value: ScribeDocReadValue ( $apple)]

Set Variable [$val; Value: ScribeDocReadValue ( $peach)]

Set Variable [$val; Value: ScribeDocReadValue ( $orange)]

 

$val would be overwritten with differing values, so am I wrong and/or need to do something else?

TIA for your reply.

Edited by WF7A
Link to comment
Share on other sites

Hi WF7A,

You are partially correct in that you will need to call ScribeDocReadValue for every field in the PDF that you want to read into FileMaker. However, the basic workflow for this would be: call ScribeDocListFields, this will return a return-separated list of all fields in the PDF. You will then loop through this list calling ScribeDocReadValue in a set field script step for every iteration in the list. In order for Scribe to read values from a PDF it must have named fields otherwise Scribe can not read from the PDF. 

 

Link to comment
Share on other sites

Hi, again:

I tried what you suggested but due to my ineptitude, I just can't get the script to work. Could you upload or show an example of importing a .pdf from the desktop with say, three fields? (Under the #Load a Document, I set the variable with ScribeDocLoad ( Get ( DesktopPath ) & "/Test.pdf" ) -- stepping through the Script Debugger, that seems to work, but it's the looping/other set-up part I'm stuck on. Thanks.

Edited by WF7A
Link to comment
Share on other sites

I don't have a specific example of this. There should be several examples of looping through a value list out there. Essentially you will need a variable to hold your return-separated list which will be populated using ScribeDocListFields, a variable to count how many times the loop has run (initialize it to 1) and used to set an exit loop condition, a variable to hold the total number of values in the value list to compare to the count in the exit loop step, and a variable to call GetValue to get the value at the certain index of the list.  This page has an example of looping through a value list to help you get started. It does have some logic that you probably don't need but it has the basic steps you will need to loop through a value list.

Link to comment
Share on other sites

Thanks for the comment.

I scratched my head for a while after reading your suggestion and trying many iterations of loops, then it occurred to me that I really didn't need any looping at all--it was a simple matter of doing a "straight" import of the field contents. (See attached.) So, I'm good-to-go, now.

PDF Field Import.pdf

Link to comment
Share on other sites

Looping would make the script a bit more dynamic but hardcoding the values certainly works as well. Of note, if you are not going to loop through the value list then you can probably get rid of the ScribeDocListFields step unless you are using the value list in some other way. 

Please let us know if you have any questions or run into any other issues!

Link to comment
Share on other sites

  • 3 months later...
  • Newbies

Hi WF7A,  You have included a sample of how to do an import from a PDF into a Filemaker solution.  I am struggling to push data from a Filemaker Solution to a fillable PDF.  I can't seem to connect the dots on the Set field script step.  Following your logic of the ScribeDocReadValue but substituting the ScribeDocWriteValue but it seems I am missing a step?
  Any suggestions on how I might do that.  Thanks

 

 

Edited by bgelly
Link to comment
Share on other sites

Hi!

I haven't tried pushing the data out to a .pdf, yet, so your best bet is to create a new "case" with 360 Works; I'll keep an eye out for their reply since sooner or later we'll need to do that as well.

Cheers!

Link to comment
Share on other sites

Hi bgelly,

When pushing data from FileMaker to a pdf, you will want to use a Set Variable script step not a Set Field as this will tell FileMaker that you are trying to set that FileMaker field with ScribeDocWriteValue which will not work. Taking from the message you sent, if you want to write to the Firstname field in the pdf with the value in the fname field in FileMaker, your basic workflow will be this: load the document with ScribeDocLoad. Next, write to the Firstname field in the pdf using the value in fname field like this Set Variable[$write ; Value: ScribeDocWriteValue("Firstname"; Contacts::firstname)] . You will then repeat the process for each field in the pdf changing the first parameter of ScribeDocWriteValue to the name of the field in the pdf and the second parameter to the FileMaker field reference that holds the value you wish to write to the pdf. Once you have done that you can save the pdf to a container field with ScribeDocSaveContainer or to a file path with ScribeDocSaveFile.

Link to comment
Share on other sites

  • 1 year later...

I thought I'd bump the thread to include the looping script I composed to load a .pdf, parse its fields, then populate the FileMaker Pro database. 

Cheers!

Note: In line 28, I used a calculation field, FieldList_Sorted__lct, instead of FieldList__lxt, because I have so many values in the .pdf that I want to import from that I wanted the list sorted in ascending order to make it easier to troubleshoot troublesome fields (which are listed in ascending order in the FileMaker Pro's field editing screen) since Scribe imports the fields unsorted.

To convert the unsorted list into a sorted one, I made a dynamic value list out from the FieldList__lxt field then used FieldList_Sorted__lct (calculation/text/unstored, ),  defined as follows:

ValueListItems ( Get ( FileName ) ; "Values" ) 

...with Values being the value list name.

 

Screen Shot 2018-01-05 at 12.41.56 PM.png

Edited by WF7A
Added additional info
Link to comment
Share on other sites

This topic is 1639 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.