Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 4042 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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!   :)

Posted
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)?

Posted

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
Posted
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"?

Posted (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 by comment
Posted

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!

Posted

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.

Posted

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.

This topic is 4042 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.