Importing matching images in Filemaker

I wasted a whole week on a Filemaker problem when trying to re-import images. In my database, I had several thousand images as links to the original files. The images were in JPG and now I wanted to replace them with PSD versions that were located at the exact same location on the hard disk. For each image I had meta information that I did not want to loose. I created a new field called “path_correct” in which I substituted “jpg” with “psd” from the image path field to get an accurate match with the PSD files. You can also get the path by using the GetAsText function on the image container.

In theory, you could import the folder that contains all the PSD images and select “import matching records” and use the path_correct field as the matching field. What happened during the import was very confusing at first. If, for example, I had four images in a sub folder, then all those four images would receive data from only the last image in the folder.

The problem is that although the field “path” or my “path_corrected” shows that whole path, including the file name,

file://hardDisk/Users/bartneck/Documents/photos/minifigure-01165/minifigure-01165-01.psd

the matching worked only up to the folder level, excluding the image  file name, in this case minifigure-01165-01.psd. During the import, Filemaker found several matches in the database for

file://hardDisk/Users/bartneck/Documents/photos/minifigure-01165/

and imported the data into all matching records. This is a true bug with Filemaker. The path field shows the path including the file name, but during import only the path excluding the file name is being considered. This is also not documented at all.

The solution is to use both the path and the filename field as matching fields for the import. Then each image in the database has a unique identifier that matches the images on the hard disk. I hope that this post helps others to avoid the same problem.