October 19, 201312 yr Hi! I multiple records with multiple images (number varies). I am trying to write a script that will rename the exported images to another field's contents and then append the new file name with _1 _2... for each image attached to that particular record. For example: 1_1 1_2 1_3 2_1 2_2 3_1 This is what I have so far. It is working, but it is only grabbing one image per record and skipping the others. Returning only 1_1, 2_1, 3_1 ... Any ideas? Go to Record/Request/Page [First] Loop Set Variable [ $filePath; Value:Get ( DesktopPath ) & "/ExportFolder/" & Table:Field Name & "_" & List ( 1 ; 10 ) ] Export Field Contents [ Images::Image; "$filePath" ] Go to Record/Request/Page [ Next; Exit after last ] End Loop Any help would truly be appreciated!
October 19, 201312 yr I multiple records with multiple images Where exactly are the multiple images? Are they individual records in a related Images table (as would seem from your description)?
October 19, 201312 yr Solution But you are looping in the "main" table and your loop has only one Export Field Contents step - so you are only exporting the first related image. Also, the expression List ( 1 ; 10 )makes very little sense here. Try something like this (untested): Go to Record/Request/Page [First] Set Variable [ $filePath; Value:Get ( DesktopPath ) & "ExportFolder" ] Loop Go to Related Record [ Images; Show related only ] Loop Set Variable [ $fileName; Value:ParentTable:Field Name & "_" & Get ( RecordNumber ) ] Export Field Contents [ Images::Image; "$filePath/$fileName" ] Go to Record/Request/Page [ Next; Exit after last ] End Loop Go to Layout [ "ParentTable" ] Go to Record/Request/Page [ Next; Exit after last ] End Loop
October 19, 201312 yr Author Okay, now I am returning: 1_1 1_2 1_3 2_4 3_5 Is there a way to make the script start over with _1 for each record? Thanks so much!
October 19, 201312 yr Is there a way to make the script start over with _1 for each record? Well it should do that, so something must have gone wrong. Are you sure your GTRR step is set to "Show only related records; Match current record only"?
October 19, 201312 yr Author Awesome!! That was the problem. Also, apparently I need to run the script from the parent table for it to work properly. Thanks again.
October 19, 201312 yr You could export from the Images table, too - but then you'd need a summary field with restart in order to number the files. --- .... or (I meant to add before I was disturbed) a counter $variable that would reset itself back to 1 when the ParentID value changed. Edited October 19, 201312 yr by comment
October 21, 201312 yr Author I have multiple images stored as individual records in a related table. Each image is stored as a path in a container field. My question is: Do I need to re-import the container contents every time the image is modified/edited (also if the image were to be moved and then put back)? Seems like the field contents should update automatically via the path. Am I missing something? Thank you!
October 21, 201312 yr I have merged your two topics. Please do not create multiple topics on the same need. If you have any questions about this action, please contact me by Private Message.
October 21, 201312 yr Seems like the field contents should update automatically via the path. I believe so. Do you experience anything to suggest otherwise?
October 27, 201312 yr Author Okay this worked perfectly at home, but when I tried to implement this at work on the host; the files are exporting into the Filemaker Pro folder instead of into the desktop folder. Don't understand why it would be working any differently. It is a shared database and I am installing the script on the server running FM 11 pro.
October 29, 201312 yr I believe there are some limitations when using the Export Records step in a server-side script; see the help for details.
Create an account or sign in to comment