Why not simply make the container field part of the same part record so that when you pull up the part, you pull up its image?
Or a related tables of images could be linked to the part record in a relationship and this could be used in very similar fashion to display the part image.
If you want to open the actual PDF File, you have a number of options depending on how the file was inserted and what storage options you have specified for the container field.
Export Field Contents can open a copy of the PDF file exported to any number of different locations--including the temporary folder where the exported copy will not be retained. This method works with all container fields so is the best all around choice.
If you inserted the file by reference and if the field does not have external storage specified, go to Field [select] can open the copy of the file referenced in the container field. It is also possible to extract the filepath from a container field and use Open URL to open the file.
The form view of the part has a container field displayed on a side where the image will display as the end-user browses through them.
But what i'm mainly trying to do is to find a way for the database to automatically reference related pdfs .
As of now, new parts are imported weekly through an excel spreadsheet. And the parts' pdfs are stored in a location, all in the same folder. Is there a way where somehow i can type out a filepath on excel to match the part name and pdf name ( which are the same with the exception of the .pdf at the end of the pdf file ) in order to auto import the reference location for the container to pull the image from?
I'm trying to avoid manually importing or referencing pdfs one by one.
With a plug in to list the file names of very file found in a given folder (there are quite a few that can do this), you could script a process where you select one file from the folder and the scrip then imports all of the PDF files in the same folder via a looping script.
Or, if you import a file path from another file such as your excel file, A script can use that file path to insert the specified file (or all files in the same folder via the method just described in the previous method).
Both methods would set a $Path variable to the file path so that insert File or Insert PDF could be used to insert the file for you.
For more on using a $Path variable with container fields and different script steps, see: Exploring the use of a $Path Variable in Scripts
Thank Phil, that's very helpful. I just came across an issue though. I tried importing the path file alongside every item from the excel file but when i script it to insertfile it gives a message saying cannot find file. The files are placed on a server directory. When i try to reference a file from the pc's local drive it works. Is there any workaround to this?
The files can't be moved from server to local. the idea is for all end users to be able to view the pdfs and embedding themin the container is not the route i want to take because of a large number of parts.
i did a getfilepath after manually importing a file from server and seems like i was using the wrong filepath name and also seems like the slashes are inverted for filemaker.
Is there a quick way to invert the slashes in a filepath with a script during import?
It would appear that your file path is not valid or this should work. Try inserting a file manually into the exploration file that you can download from that other thread. Then compare the file path extracted via calculation fields in that file to the file path you are assigning to a variable. Chances are that there is some difference between the actual file path that you see in this file and the one you are assigning to your variable.
yes there was, when i copied the filename from windows explorer it showed at u:// whereas when i did an extraction of the filepath with the script from filemaker, it showed as ntserver10// . That helps make things easier!
Thank you again Phil!