Jump to content

script to import multiple pdf


Recommended Posts

good night gurus,

need guidance on how to put together a script that would allow me to import multiple "PDF" documents from a folder.

e.g. a users would scan a series of documents placed them in a folder, (the folder would be manually created and named based on the record ID), once a button is press FM would go to that location and import whatever documents are in the folder.   

FYI... I tried looking for a scanning plugin but unfortunately the scanners i have are Canon and they are not TWAIN compatible.

 

Thanks

RudyM 

Link to post
Share on other sites

In the Import Records script step, you can specify a folder as the data source and select "Picture and movie files" as the file type. You can also set a variable to the path to the folder (ending with a "/") and use it to specify the folder location.

 

Link to post
Share on other sites

Thanks, but how would i import the entered content of the folder. 

Thanks

RudyM

Link to post
Share on other sites
Posted (edited)

Thanks for your help, I read the the links, but i am having a hard time putting together the import script. 

UNC Part: \\ap1-srv-apps02\bmr\scans\scans\"

Folder Name: WO-X-XXXXX (ticket ID)

"WO-" is not part of the ticket ID only part of the folder name 

The ultimate goal is to import everything inside the folder.

This script is generating an error that it cannot find the file 

What i am doing wrong. Thank for you help.

 

image.png

Edited by rudym88
Link to post
Share on other sites

Why don't you start with something simple:

Place a folder named Scans containing a few PDF files next to your FMP solution file, then run this script:

Go to Layout [ YourTargetTable ]
Set Variable [ $folderPath; Value: "Scans/" ]
Import Records [ Folder Name: $folderPath; File Type: Picture and movie files; Target: “YourTargetTable”; Method: Add ]

Note that this will create an individual record for each file in the Scans folder. Your target table needs to have a container field to which you will map the image, and optionally fields for file name, file path and thumbnail which the import can populate too. Your script starts with creating a new record explicitly - I am not sure for what purpose. 

Once you have this working, you can move on to constructing the path to your real folder.

 

Link to post
Share on other sites

Thanks,

There are two tables (Ticket and Ticket Attachment), "kTicketID" is the key field linking the two tables.

The idea is to set a variable with the "Ticket ID", create a new record in the "Ticket Attachment" table and use "set field" for each document being imported from the particular folder.

Thanks

Rudy

Link to post
Share on other sites
7 hours ago, rudym88 said:

The idea is to set a variable with the "Ticket ID", create a new record in the "Ticket Attachment" table and use "set field" for each document being imported from the particular folder.

I still don't see why you're creating the new record. If I understand correctly, you should be doing: 

Set Variable [ $ticketID; Value: Ticket::TicketID ]
Set Variable [ $folderPath; Value: "Scans/" ]
Go to Layout [ Ticket Attachment ]
Import Records [ Folder Name: $folderPath; File Type: Picture and movie files; Target: “Ticket Attachment”; Method: Add ]
Replace Field Contents [ Ticket Attachment::TicketID; $ticketID ]

The import Records step will create a new record for each file in the Scans folder. The Replace Field Contents step will make the entire imported set related to the original record in the Tickets table.

 

Edited by comment
Link to post
Share on other sites

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

×
×
  • Create New...

Important Information

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