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

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

Recommended Posts

Posted

The task here is to extract thousands of jpeg files in container fields and export them to a particular folder. I'm guessing I can use the script:

Export Field Contents [; ""]

... and loop the script with variables set. The field name is Clinical::LabReport. I would like to set the to the field contents of the PatientID field, that is unique in each record. This is where I need help; defining and implementing the variables, and the script steps to loop the found set. Hope this is possible.

~Dennis

system: MacG5, FileMaker 8.5.

Posted

You can not export the Data in a Container Field in version 7 without a plugin. In v8, you can export Field Contents but it doesn't seem to save a name. However, I'm still neebee with v8, so someone else may have better advice on this.

Lee

Posted

Thanks for the response Lee. I'm in FM 8.5, and the filename is where I am stuck. Hoping to get past it using a local variable, but don't know how.

~Dennis

Posted

Oops, I could swore that your profile said v7, sorry. It still might take a plugin to do what you want.

I haven't played with v8.5 yet, but it sounds like Export Field Content hasn't change then. Try doing a search of the Forum using [color:blue]+Export +Container +Field, as the Keywords (include the pluses as shown), with [color:blue]Fenton as the member, and you should find a a couple of Treads on and AppleScript.

HTH

Lee

Posted (edited)

You can use a variable to export a container, just like in any other export. For example, the following script exports all images in ImageField to a folder named ExportedFolder located at user's desktop (the folder needs to exist beforehand), naming them sequentially.

Show All Records

Go to Record/Request/Page [ First ]

Loop

Set Variable [ $filePath; Value:"filemac:" & Get ( DesktopPath ) & "/ExportedFolder/" & Table::SerialID & ".jpg" ]

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

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

End Loop

---

I'd suggest you try this with a small found set, until you get it to work.

Edited by Guest
Posted

Oops, hit a bump. Used this script on a small found set of records with container fields to export:

Go to Record/Request/Page [ First ]

Loop

Set Variable [ $filePath; Value:"filemac:" & Get ( DesktopPath ) & "/Docs/" & OUTSIDE ADMIN DOCS::DocsID & ".pdf" ]

Export Field Contents [ OUTSIDE ADMIN DOCS::OutsideAdminDocs; “$filePath” ]

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

End Loop

... and get this error when I run the script through the debugger in FileMaker 8.5 Advanced:

ERROR: "100664.2-Docs-1581.pdf" could not be created on this disk. Use a different name, make more room on the disk, unlock it or use a different disk.

The filename is legal as far as I can tell. Ran one container field with a test Export Field Contents script by itself, and it ran fine. I'd be so happy if someone has an idea to correct the local variable setting.

~Dennis

Posted

I got that error initially because I had selected / added the folder using that option in the Export File Contents, the path looked like [color:blue]file:../../../../../Users/leesmith/Desktop/Export/$filePath,, but your path looks right, is the folder "Doc" labeled correctly?

If you want to post a demo of your files, I'm sure we can spot the problem.

Lee

Posted

Thank you both for trying to help me with this. The filenames are unique and the Docs folder is the same in both the script variable value and Desktop. So let me create a new database with different container contents, run an adapted script and see what happens. I will post back with the results. I am truly grateful for your assistance here.

~Dennis

Posted

It should be simple enough to insert a pause in the loop (or use the debugger) and see if a file with the problematic name already exists in the exported folder before the error occurs.

Posted

Attached is a zipped test file that illustrates the clinic database issue that gives the script error:

"GMa_4321.jpg" could not be created on this disk. Use a different name, make more room on the disk, unlock it or use a different disk.

The error generates from this script:

Show All Records

Go to Record/Request/Page [ First ]

Loop

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

Export Field Contents [ ScriptTest::Container; “$filePath” ]

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

End Loop

Make yourself a "Docs" folder on your desktop. I eagerly anticipate your observations and recommendation.

~Dennis

ScriptTest.fp7.zip

Posted

Your file path is wrong (same mistake as I pointed out). it contained [color:blue]file:$filePath

It should only have [color:blue]$filePath as the output file path.

Lee

Posted

Hello Lee,

Thank you for pointing out the error. If you would be kind enough to write the script step for me with the correct syntax, then I will be able to understand how this script is supposed to run. I sincerely want to understand this so that I might make better use of parameters and variables in future work.

Gratefully,

~Dennis

Posted

Open ScriptMaker and select the Export Field Contents step.

Click on Specify... (Specify output file).

Delete the "file:" prefix, so that the Output File Path reads as:

$filePath

instead of:

file:$filePath

Interestingly enough, the script step displays and prints the same way after the correction (a bug or a feature?). But the difference is it will work now.

Posted

Oh YES!, it does work; on my test file and in the production environment. I'm really quite thrilled. Thank you so very much for teaching me about this. This opens up a new world for me. Wow!

~Dennis

  • 6 years later...
  • Newbies
Posted

Hi,

Very good post. I was able to follow it as far as I needed to have the pictures exported from the photo container field in my table. Upon each export I was prompted to "Save" each image, is there a script step that will "Click" the "Save" button each time, so that it's a one click script without requiring the click on "Save" button.

 

Thanks

 

entourage99

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