Container contents renamed and now "missing"
FileMaker Server 22.214.171.1240, Mac OS X 10.9.5 (13F34), Mid 2010 Mac Pro
FileMaker Pro Advanced 13v4, Mac OS X 10.10.1 (14B25), Late 2013 Mac Pro
Container field is set to external storage
We have a table that we use as a document store. We're tracking 61,646 documents and I discovered some strangeness with 9 of them.
We have a nightly script that builds a combined PDF of certain documents in our system. It does so by looping through the pertinent records in our document store table calling Export Field Contents. Every now and then, the script will get blocked by an error dialog stating "Container fields cannot be exported". This bypasses the Set Error Capture [On] I have at the top of the script (and it's also worded very generically and seemingly not related to that specific record).
I finally managed to track down one of the records in our document store that was causing this. It's because the container field is showing the document is missing. Going to the location on disk where the document is actually stored, I see the PDF is indeed there. But the filename had "_1" inserted into it. So if the original file uploaded was named "146523.pdf" the file on disk is "146523_1.pdf". The two auto-generated thumbnails do not have the "_1". And presumably this is why FileMaker thinks the file is missing. Removing the "_1" from the file on disk and refreshing the record does NOT result in the container now "seeing" the file.
By searching around on disk for other files with "_1" in the name, I found a few others. I even found one with "_2" added to the name that was exhibiting the same problem. I also found one with "_1" added to the name that DID still work.
The documents in our system are added on a layout with an interactive container field that the users drag and drop the files into. Wanting to get our data back into place, I grabbed the files off the disk and reinserted them (via drag and drop) into the original FileMaker records. For the first record, after removing the "_1" from the filename I dragged the document into the container but FileMaker still showed the file as missing. The reuplaoded file, however, appeared on disk with the proper name and the thumbnails refreshed. The "_1" copy of the file remained in the folder.
So I entered the container field, hit delete, and everything cleared out of the record as expected along with the reuploaded file and its thumbnails being removed from disk; the "_1" file remained (which makes sense, since FileMaker claimed to not know where it was). Manually deleted the "_1" file from disk, reuploaded the file again, and everything was fine.
For the next record I figured I'd delete the contents of the container field first and was presented with the Yes/No dialog "The external file can not be deleted from disk. Do you want to delete the reference to the file anyway?". Clicking yes removed the two thumbnail images but left the "_1" file there. I deleted that manually and reuploaded the file and all was well. I followed this procedure to fix the remaning missing documents.
- Has anyone seen this sort of behaviour before?
- Why is FileMaker renaming the files on disk in the first place? It seems to be doing it after the thumbnails are generated.
- How is it then losing the reference to the file it renamed?
- Why did one of the files it renamed remain accessible in the container field?
- Why did it only happen on 9 out of 61,646 documents?
- How much wood could a woodchuck chuck?