how is "recordID" determined? Have you checked to be sure there's a file in the folder named 10000.jpg?
("RecordID" can be an auto-entered serial number field, but there's also a function: Get (RecordID) that some people try to use in place of the serial number. That second option doesn't usually work well when importing data into a clone, so I am checking on that possibility. )
Q1: Yes, there is a file in the folder named 10000.jpg (it is actually named IMG_10000.jpg I simplified the file name in my earlier post)
Q2 When the record is originally created, it is an auto-entered serial number field (On Creation next serial number IMG_10204 increment by 1). However, in this case, I am importing data from a data set and recordID is copy from that dataset When checking each record after the data import, the recordId is imported correctly. The data import script seems to work perfectly.
The problem is the image import script, which follows after data import.
See 1st post) After creating the variable $filepath, I dumped it into a field for testing. The variable seems to get the correct pathname and recordID:
But for some reason the Insert Picture ["$filepath] command chokes in the script. I know that when I specify the Insert Picture file manually in the script through the Add File button, it puts the term "image:" in front of the pathname/imagename.jpg.
Is the term "image:" important to have in the pathname? If so, how is that to be structured? Thanks.
You need imagemac: (all lower case) not filemac: The two different tags depict two different methods of inserting a file into a container. Use imagemac with insert picture and file: or filemac: with insert file.
Ah! It works Perfect!!!
Many thanks, Phil, it seems so logical now that I see it. A follow up, question. What gets inserted at the front end when importing to a PC?
The drive letter is the first item in the file path. You can see the text entered into any "store a reference" container field by using Getastext ( container field) in the data viewer (Filemaker Advanced), or you can use a calculation field set to return text with just the name of the container field entered into it.
This is often a useful way to debug issues with file references stored in containers--especially if you have both mac and windows clients sharing the database.
Very good, thank you.
Hmmm, you may have been asking what to use in place of "imagemac:", if so, use "imagewin:"...
Actually, both answers are helpful. I seldom work in a Windows environment but I will have clients using this solution who will. I will need to work on some logic for these scripts that will work in both environments. For example, when creating the directory that gets placed on the Mac desktop is had to use an Apple Script
Perform AppleScript ["do shell script "mkdir -p ~/desktop/" & quoted form of "Export_Images"]
Cheers, Phil. Have a great day. -- LC
Yes, FileMaker is unable to create new directories on either platform. One method is to use a system script such as Apple script and then you end up with one system script for Mac systems and a different script (VB Script, batch file, etc.) for windows platforms. It's possible to create and store the script in a text field, then use export field contents to export the script and use send event to open and run the script.
Another options is to acquire a plugin that offers the ability to create folders and use it. MooPlug is a windows only free plug in that can create folders if I remember correctly.
The draw back to using a plug in is that there is no guarantee that it will be properly supported by the developer if a new release of FileMaker is not compatible with it.