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

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

Recommended Posts

Posted

Hi All

I have a simple FMPro 8.5 database and I am trying to write a script in Scriptmaker to write one file for every record, containing the content of just one field, and with the file named according to the content of a different field.

The following is a screenshot of what I have tried to do:

Picture 283.png

It doesn't work, of course!!

I have 2 problems :) (1) I don't know how to create the filename out of a field's content [so I've used qqq.htm just as a placeholder, until I could figure that out]; and (2) I'm not sure how I'll get a set of files (one for each record) written into the folder I want (called "specimens", in the same folder on my Mac as the FMPro 8.5 database resides.

Could somebody please help me to get it to do what I need. Mnay thanks. Philip

Posted

Not sure if it will work with 8.5. but you need to create a variable for the file name, and then use that variable as the name in the export dialogue box.

In this case my variable = '$file'

Set Variable [ $file; Value:

Get ( DesktopPath ) &                     //this is the path to your desktop

last_name &                                    //this is the value from one of the fields

".csv"                                               //this is the file extension

]

Go to Record/Request/Page [ First ]

Loop

Set Variable [ $file; Value:Get ( DesktopPath ) &  export field::last &  ".csv"  ]

Export Field Contents [first_name; “$file” ]

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

End Loop

Posted

First, put the Go To Layout step above the Loop. Notice that rivet checked the "Exit after last" option (or the loop will never end), and rearranged your steps.

The file path to the folder of the FileMaker file (on a local computer, not a hosted file) can be calculated, result Text, Storage [x] Do not store.

Substitute ( Get ( FilePath ); ["file:/"; ""]; [Get ( FileName ) & ".fp7"; ""] )

Example: Macintosh HD/Users/fej/Documents/FileMaker/My_FM/CONTAINER/Blobbo/

Add an "absolute" prefix & your file name to this.

"filemac:/" & Substitute ( Get ( FilePath ); ["file:/"; ""]; [Get ( FileName ) & ".fp7"; ""] ) & "file name.txt"

Typically you would get the file's name from some unique field (ID) in the FileMaker record, and use in the above calculation, instead of "file name".

Posted

Thank you, Fenton. Rivet's answer (and your explanation) worked perfectly! Regards, Philip

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