November 20, 201312 yr Using FM12 Advanced, I'm setting a Container field to "Store container data externally" in "Open" format. I have a relative directory defined & available, and a separate calculation in the "Open storage:" field beneath. Everything's working as I expect -- i.e. I can use a "Let" calc. in the open storage field to define an arbitrary pathname for each new file added to a container field in each new record -- BUT I can't figure out how to programmatically set the *file name* itself in this operation. ----- What I am trying to do: In the Finder, drag a file (JPG image in this case,) with filename "JohnDoe.jpg", into a Filemaker container field w/ managed storage. Have Filemaker receive & store that file within its Managed Storage hierarchy that I've defined. But with a new, arbitrary file *name* as well, i.e. "2013_11_14_JohnDoe-Profile.jpg". Why is my calculation (copied below) not setting the file name properly? The file lands in the correct Filemaker-controlled Managed Storage directory, but the filename remains "JohnDoe.jpg". How do I get Filemaker to store the file as (for example) "2013_11_14_JohnDoe-Profile.jpg"? Let ( [ $directory = "Multimedia/" & MainCategory & "/" ; $filename = Case ( MainCategory = "CATALOG_ITEM" ; CATALOG::C_ItemImageFileName & ".jpg" ) ]; Case ( MainCategory = "CATALOG_ITEM" ; $directory & CATALOG::C_ItemImageFileName & ".jpg" ; $directory ) )
November 20, 201312 yr You can't do it in one step because calc is meant to just provide a folder name. If you want to rename the file, let the user drag & drop into a global container, then use the "export field content" to export it to the temp folder with the filename you want and then have the script insert it into the destination container
November 21, 201312 yr Author Thanks for your reply. I got this working (see linked demo file,) but am now frustrated by the problem of removing the temporary files that will build up with this method. Probably I will go ahead and use a 3rd party plugin (MonkeyBread Software) to handle file operations until (if) Filemaker 13 or later starts supporting file ops natively.
November 21, 201312 yr When you close the FileMaker app, FM empties the temp folder ( located at Get ( TemporaryPath ) ).
November 21, 201312 yr Author Thanks for that tip, I'm using Get (TemporaryPath). That'll enable possible future cross-platform or multi-user situations. With appreciation, -G
Create an account or sign in to comment