Use:Set Variable [ $filename; Value:“file:../../38 Projects/TDA 2nd pass/" & TDA::doc_ref_no &".txt" ]Export Field Contents [ TDA::Notesp01; $filename ]
Thanks for the prompt reply.
I have made the changes you suggested - now my script and your tweakes look to be the same but still I get 1 file "$filename" written 10 times and not 10 x files. The loop appears to be looping and writing but the file creation element seems not to be working. Its strange
Check for quotation marks inside the Specify Output File dialog box. If there are quotes around $FileName, they are the source of your trouble and they need to be removed.
HiThe Specify Output File dialog box. does not have quotes around $FileName. However the script screen does show "$filename" . The quotes are seemingly added automatically and there is no direct way, or I cannot see a direct way, to remove them.Regards
That then shows correct syntax. If the script editor showed ""$filename"" then you'd know that you had quotes in the specify output file dialog that shouldn't be there.
From here, I can't see exactly why you are getting "$filename" as the actual name of the file.
Two things I would check if I were you:
I'd use the data viewer and script debugger to check to see what value is being set to $filename in the script and what value is being returned by TDA::doc_ref_no. If you don't have FileMaker Advanced, you can use a Show Custom Dialog placed just before the Export Field Contents step to check the values that way.
I'd delete all files from the folder to which the script is exporting text files before running the script again, just to make sure that I am not confusing files created by an earlier run of the script with the files created by this run.
If all else fails, you could post your complete script.
To post a script to the forum:
- You can upload a screen shot of your script by using the Upload an Image controls located just below Post A Answer.
- You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here.
- If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
- If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format. (Use the HTML option on the database tab panel and paste the text into the forum's HTML editor.)
I dont have FM Advanced.But I did add a Show Custom Dialog event before Export Field contents event in the script.
I stepped through the script which passed correctly each doc_ref_no file name in sequence and stopped after the number of found records. As usual I ended up with a single file called $filename.
I attach a screen grab of the script. Thanks for your help with this
Note that you have misspelled the variable name in the Export Field Contents step. You have an extra "i" in there.
Doh,Thats what happens if you stare at a screen all day. Note to self - get eyes checked.Thanks for spotting that- we are perilously close to the script working, however FMP is not letting me off hook yet.Made the change (deleted extra i) and kept the Show Custom Dialog in place ran the script and at each file name I got tan error message -see below. Interestingly no file of any name was written to the target folder which is indicativa that variable/loop is working. Its just the file creation/writing thats not.I am using a bog standard Mac Mini 2.4 GHz Intel Core 2 Duo with 8 GB RAM and 213GB free space. It is running the latest update to FMP12. Problem is I need the name format (whole point of exercise), there is lots (and lots) of space on the HD, the HD is not locked- or if it is , it has happily had files written to it nearly every day for 2 years and I dont really want to get another disk- but might have to.Last(ish) question= What do you make of the error message?Thanks your for your help once againDavidF
That particular error message is one of the more misleading ones in Filemaker. It only means: "I couldn't create the file". It doesn't know which issue was the actual cause and those listed are not the most likely culprits.
An invalid filename--one with characters that can't be used in af file name, will trigger this error.
An invalid file path--the number one source of this error in my experience
Lack of room on the hard drive
A location where "write" permission is not permitted for the current user
All can trip this message.
I don't think a file path with ../.../ will evaluate correctly here. I believe that you need to use the "fully qualified" file path instead.
Hi,As you predicted a fully qualified file path fixed the problem.I really appreciate the the help.RegardsDavidF