AnsweredAssumed Answered

Script For "Insert File" Based On Record Data

Question asked by jgcpts on Aug 22, 2018
Latest reply on Aug 29, 2018 by Johan Hedman

-- Please see the information and let me know if this would even be possible. --

 

I've been asked to develop a script which would fill a container field for each record on a table with a Stored Reference to a PDF file if it is present in a specific directory within a Windows file system.

 

The script needs to operate based on the following:

 

1) The file path generated by the script for needs to be specific for that FMP file (planned to reference either another field or the FMP file name if possible)

2) The file name generated by the script needs to be different for each record, based on values from other fields in that record

3) The script (or scripts) need to remove punctuation which would result in a broken or impossible link (like a . at the end of a Company Name

4) The container needs to store only a reference

 

Example:

 

Project1.fmp12

Company NameType
ReferenceData File Location (not visible to user)
Adam's ApplesPOadobe-pdf-icon.pngfilewin://SERVER/Documents/Projects/Project1/PO - ADAM'S APPLES.pdf
Bob's BurgersCadobe-pdf-icon.pngfilewin://SERVER/Documents/Projects/Project1/C - BOB'S BURGERS.pdf

 

Project2.fmp12

Company NameTypeReferenceData File Location (not visible to user)
Cody's Carrot Co.
POadobe-pdf-icon.pngfilewin://SERVER/Documents/Projects/Project2/PO - CODY'S CARROT CO.pdf
Dan's DinnersCadobe-pdf-icon.pngfilewin://SERVER/Documents/Projects/Project2/C - DAN'S DINNERS.pdf

 

 

I had originally considered creating a hidden field (or fields) which would find and insert values from the other fields in the record to produce a unique file path. The script would then create the file reference based on a lookup of that field's text value. Never got that "calculation" to work.

 

Any information is appreciated!

Outcomes