Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

Export image with filename: product ID


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

Recommended Posts

Posted

dear fmforum,

my database has many products and each has its unique product ID.

each item has 1 to 6 images.

i added a "button setup" to the image in the layout.

it triggers a "export field content".

it exports the image to my desktop with the filename 1,2 ... till 6.jpg

is it possible to export the image with the product ID as a filename?

e.g. 232345.jpg, 232345-2.jpg ... till 232345-6.jpg

sincerely,

raitis

Posted

i tried to add this to the "specify output file":

Show All Records

Go to Record/Request/Page [ First ]

Loop

Set Variable [ $filePath; Value:"filemac:" & Get ( DesktopPath ) & "/Docs/" & Products::Product ID & ".jpg" ]

Export Field Contents [ Table::ImageField; “$filePath” ]

Go to Record/Request/Page [ Next; Exit after last ]

End Loop

i get this error:

please correct the syntax of this line:

Set Variable [ $filePath; Value:"filemac:" & Get ( DesktopPath ) & "/Docs/" & Products::Product ID & ".jpg" ]

can you help me?

what is wrong?

sincerely,

raitis

Posted

/docs/ could be the problem.

Not sure if you need the first /

Does docs folder exist on the desktop?

Use a dialog box to show $filepath, that should reveal all.

Posted

i get this error:

please correct the syntax of this line:

Set Variable [ $filePath; Value:"filemac:" & Get ( DesktopPath ) & "/Docs/" & Products::Product ID & ".jpg" ]

I have never seen such error message. Can you post a screenshot of it?

Anyway, I believe that since you are running under Windows, $filePath should be set to =

"filewin:" & Get ( DesktopPath ) & "Docs/" & Products::Product ID & ".jpg"

Posted

/docs/ could be the problem.

Not sure if you need the first /

Does docs folder exist on the desktop?

Use a dialog box to show $filepath, that should reveal all.

i removed the first /

nothing changes.

I have never seen such error message. Can you post a screenshot of it?

Anyway, I believe that since you are running under Windows, $filePath should be set to =

"filewin:" & Get ( DesktopPath ) & "Docs/" & Products::Product ID & ".jpg"

screenshot attached.

i am using MAC not win.

still not working :(

post-106152-0-72267100-1347601605_thumb.

Posted

Could you move that error window a bit and show us what you have in the Output File Path List? It looks like you have typed the entire script there? If so, please see:

http://www.filemaker.com/11help/html/create_script.12.3.html#1037007

Posted

That's not going to work. All that should have been there is:

$filePath

Of course, you cannot use the $filePath variable without defining it first; that's why you need a script, with several script steps, instead of a attaching the button to a single action.

Posted

That's not going to work. All that should have been there is:

$filePath

Of course, you cannot use the $filePath variable without defining it first; that's why you need a script, with several script steps, instead of a attaching the button to a single action.

thank you!

thats what i thought.

i will try to make a new script with this:

Show All Records

Go to Record/Request/Page [ First ]

Loop

Set Variable [ $filePath; Value:"filemac:" & Get ( DesktopPath ) & "/Docs/" & Products::Product ID & ".jpg" ]

Export Field Contents [ Table::ImageField; “$filePath” ]

Go to Record/Request/Page [ Next; Exit after last ]

End Loop

and then i will add $filePath

in the window i send you.

Posted

You will find that window in the Export Field Contents [] step, as part of the script.

thank again.

i made a script and now it works! :)

one problem:

i have 6 images for each product. each time it exports the image it overwrites the old one.

is it possible that they are not overwritten, but in this way e.g. 232345.jpg, 232345-2.jpg ... till 232345-6.jpg

Posted

Your Docs folder will still need to be "Docs/" because Get (DesktopPath) already has a terminating "/"

Posted

Your Docs folder will still need to be "Docs/" because Get (DesktopPath) already has a terminating "/"

i already changed /Docs/ to Docs/

Posted

Your Docs folder will still need to be "Docs/" because Get (DesktopPath) already has a terminating "/"

It's good practice, but it will work either way.

i have 6 images for each product.

Where are those 6 images kept? Do you have a related table of Images?

Posted

i managed it.

this is what i added:

$filePath: Value: filemac: & Get ( DesktopPath ) & "Docs/" & Products::Product ID & "_1.jpg"

$filePath: Value: filemac: & Get ( DesktopPath ) & "Docs/" & Products::Product ID & "_2.jpg"

etc.

thanks everybody :)

This topic is 4514 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.