Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Export image with filename: product ID

Featured Replies

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

See if this helps:

http://fmforums.com/forum/topic/45545-looping-script-to-extract-container-jpegs/page__st__-20#entry212714

  • Author

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

/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 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"

  • Author

/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.

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

  • Author

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....3.html#1037007

post-106152-0-81912400-1347606896_thumb.

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.

  • Author

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.

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

  • Author

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

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

  • Author

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

i already changed /Docs/ to Docs/

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?

  • Author

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

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.