July 25, 20214 yr Hello I have read the thread below about a script that will export container images to an external folder I have 11000 jpgs embedded in an FM file and I wish to migrate these files from an embedded state to an external folder. Go to Layout [ MyPics ] Show All Records Go to Record/Request/Page [First] Loop Set Variable [$filePath; Value: Get ( DesktopPath ) & MyPics::Description & ".jpg"] Export Field Contents [MyPics::Picture; “$filePath”] Go to Record/Request/Page [Next; Exit after last] End Loop Firstly, I am unsure if the above script rewrites the container path to the new folder or just exports the data but leaves the container intact. Any thoughts would be most helpful. Thank you
July 25, 20214 yr 32 minutes ago, chlowden said: I am unsure if the above script rewrites the container path to the new folder or just exports the data but leaves the container intact. It only exports the images to the user's desktop (there is no "new folder" in the script you show). No change takes place in the exporting file. To have the container field point to the exported file, you must reinsert it as reference only. Or change the field to a calculation field, calculating the path from the Description field. P.S. Make sure you have a backup before you try any of this. Edited July 25, 20214 yr by comment
July 25, 20214 yr Author Thank you for clarifying this. To be honest, I'm no script writing, and I have searched "container calculate path" on the site but nothing very pertinent comes up. Could you advise me where I might find an example script? Also, I would seem logical that the path change be part of the migrate script .. Or that not such a good idea? Many thanks
July 25, 20214 yr Your script could look something like: Go to Layout [ MyPics ] Show All Records Go to Record/Request/Page [First] Loop Set Variable [$filePath ; Value: Get ( DocumentsPath ) & "ExportedImages/" & MyPics::Description & ".jpg"] Export Field Contents [MyPics::Picture ; “$filePath”] Insert File [ Reference ; Target: MyPics::Picture ; “$filePath” ] Go to Record/Request/Page [Next ; Exit after last] End Loop This will export the images to a folder named "ExportedImages" located in the user's Documents folder, and reinsert them as reference only into the original container field. Learn more about setting up the insert file step: https://help.claris.com/en/pro-help/content/insert-file-options.html
July 25, 20214 yr Author Thank you so much for sharing the above. Maybe you can where I am stumbling as I get generic error on the script below Go to Layout ["Images" (Image); Animation:None] Show All Records Go to Record/Request/Page [First] Loop Set Variable [$$filePath ; Value: " Set Variable [$$filePath ; Value: Get( C:/Users/christ/Desktop/FM_EXPORT/HTML_files/images/ ) & Images::ContainerFieldName & \".jpg\"]" Export Field Contents [Images::Image ; “$$filePath”] Insert File [ Reference ; Target: MyPics::Picture ; “$filePath”; Create directory:On ] Go to Record/Request/Page [Next; Exit after last: Off] End Loop Layout name : Images Container field name : Image Original file name : ContainerFieldName Below is my attempt to migrate the jpgs to the folder C:/Users/christ/Desktop/FM_EXPORT/HTML_files/images/ My first question is that the script uses / like on mac when PC usually uses \ (which is what I am using.) But when I use \ in the script I get errors. I took example for the Insert File element from the link below as I did not understand why I need the Option box. https://help.claris.com/en/pro-help/content/insert-file.html?Highlight=insert file Below is the error. The user account admin and there is plenty of space on the hard drive. Any thoughts are most welcome. Thank you Edited July 25, 20214 yr by chlowden
July 25, 20214 yr I see several errors: First, you're not setting the variable correctly. You should name the variable $filePath (not $$filePath ), then click the Specify… button for the Value and enter the following formula exactly as it appears here: Get ( DesktopPath ) & "FM_EXPORT/HTML_files/images/" & Images::ContainerFieldName & ".jpg" Next, use the variable $filePath when exporting the image - again, not $$filePath . Finally, this part makes no sense to me: 2 hours ago, chlowden said: Insert File [ Reference ; Target: MyPics::Picture ; “$filePath”; Create directory:On ] Your table is named Images and your container field is named Image - so how can you possibly use MyPics::Picture? Do you even have such table/field? Also, Create directory:On is not an option for the Insert File script step. Note: Filemaker uses its own paths, not your OS paths. See: https://help.claris.com/en/pro-help/content/creating-file-paths.html
July 26, 20214 yr Author Thank you for the clarifications. I still get the 8000 error but now on jpg files that have symbols that Windows does not like. I originally did the Db on a mac.
July 26, 20214 yr Author Whilst trying the troubleshoot the file name issue, I stumbled on the Container Storage option below. By clicking on the Store container data externally check box, it extracted virtually all the pictures to a folder and updated the ContainerFieldName field. A csv export shows that the database looking to an external source.
July 26, 20214 yr 1 hour ago, chlowden said: symbols that Windows does not like I am afraid I have no clue what that means. 36 minutes ago, chlowden said: Store container data externally You never told us what is the purpose of this migration. I don't have time to go into details, but you should be aware that external storage is very different from having files inserted as reference only.
July 26, 20214 yr Author The conflict with Mac & PC special characters in file names e.g. *µç¤ etc I have now read that external referenced files was deprecated sometime ago and external storage is now the revised method. I must confess that I have not used FM for nearly 10 years and I struggled with it in version 7 to 12. I used FM as a web server and at the time, the images in containers had to be internal. My goal is to extract the files and have the database intact. Once that done, either continue with FM or migrate to a php solution. Many thanks for all your help Edited July 26, 20214 yr by chlowden
July 26, 20214 yr Be aware that files store as references is a feature that is on the Deprecation list. https://support.claris.com/s/answerview?anum=000025819&language=en_US
Create an account or sign in to comment