charisse Posted October 19, 2013 Posted October 19, 2013 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!
comment Posted October 19, 2013 Posted October 19, 2013 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)?
comment Posted October 19, 2013 Posted October 19, 2013 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
charisse Posted October 19, 2013 Author Posted October 19, 2013 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!
comment Posted October 19, 2013 Posted October 19, 2013 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"?
charisse Posted October 19, 2013 Author Posted October 19, 2013 Awesome!! That was the problem. Also, apparently I need to run the script from the parent table for it to work properly. Thanks again.
comment Posted October 19, 2013 Posted October 19, 2013 (edited) 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, 2013 by comment
charisse Posted October 21, 2013 Author Posted October 21, 2013 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!
Lee Smith Posted October 21, 2013 Posted October 21, 2013 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.
charisse Posted October 21, 2013 Author Posted October 21, 2013 Sorry, I did not interpret them as the same need.
comment Posted October 21, 2013 Posted October 21, 2013 Seems like the field contents should update automatically via the path. I believe so. Do you experience anything to suggest otherwise?
charisse Posted October 27, 2013 Author Posted October 27, 2013 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.
comment Posted October 29, 2013 Posted October 29, 2013 I believe there are some limitations when using the Export Records step in a server-side script; see the help for details.
Recommended Posts
This topic is 4434 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now