June 26, 201015 yr 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: 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
June 26, 201015 yr 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
June 26, 201015 yr 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".
June 26, 201015 yr Author Thank you, Fenton. Rivet's answer (and your explanation) worked perfectly! Regards, Philip
Create an account or sign in to comment