Calculating storage path for externally stored container field

By default Filemaker stores all the files for an externally stored container field in just one flat directory structure. If you, for example, use the directory “image/” to store all your photos, then all images will be put into it without any sub directories. The file name will be the same was it was on your local disk. If you import two files with the same file name then Filemaker will automatically add serial numbers to it to avoid overwriting matching files.

Filemaker allows you to calculate the path under which a container field is stored on an external data source.  You find this setting in the options of the container field under the storage tab:

Screen Shot 2013-05-10 at 10.39.52 AM

I wanted to calculate the path depending on where the file was stored on my local file system. Photos that are locally in a folder called “photos_100” should also be stored in a directory with the same name on the server. I wrote a formula that calculates the right path for the server location based on the file path field that I fill during the import of the images. I defined a field called “image_path_during_import” which is filled with the path of the images stored on my local file system:

Screen Shot 2013-05-10 at 10.49.41 AM

The problem is that image file itself seems to get imported into Filemaker before the file path field does. That means that the field image_path_during_import is still empty while the image is placed on the server. Once the import is complete, the image_path_during_import field shows the correct data and also the server path can be calculated. But not during import.

I could only think about two methods of resolving the problem. One is to import the data in two stages. First, import the picture normally and then import the same files again, but this time only import the image and use the option “Updating matching records in found set”. Another solution is to slightly change the server import path calculation so that nothing fundamentally changes. Filemaker will then offer you the option to transfer the files to a new location and since the correct path can now be calculated, Filemaker moves the images to the right place on the server. I hope that Filemaker fixes this problem in their next update.

Leave a Reply

Your email address will not be published. Required fields are marked *