Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

script to import multiple pdf

Featured Replies

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 

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.

 

  • Author

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

Thanks

RudyM

  • Author

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

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.

 

  • Author

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

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

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.