AnsweredAssumed Answered

Scripting - Export Field Contents Problem

Question asked by DavidF on Sep 25, 2012
Latest reply on Sep 27, 2012 by DavidF


Scripting - Export Field Contents Problem


     I would be greatful for some help in spotting the obvious? mistake in my FMP 12 script.
     From a found set of records, I need to extract,the text from a text field called "Notesp01" and write its contents to a .txt file. Each .txt file is  to be named with the contents of a text field called "doc_ref_no".
     So if I have found 10 records I need to end up with 10 off .txt files each named as per the contents of "doc-ref_no" i.e tda123456.txt, tda15697.txt ......etc. All text files to be stored in same folder.
     The following script  only half works. Instead of getting 10 off indivdually named files I get 1 file written to 10 times- the resulting file being called $fiilename.
     I am new to the world of FMP variables, I think its a  variable problem, but I dont understand why its not working
     Any help with  this would be very welcome


     Go to Record/Request/Page[ First ]
     Set Variable [ $filename; Value:(TDA::doc_ref_no)&".txt" ]
     Export Field Contents [ TDA::Notesp01; “file:../../38 Projects/TDA 2nd pass/$fiilename” ]
     Go to Record/Request/Page
     [ Next; Exit after last ]
     End Loop
     output path
     file:../../38 Projects/TDA  2nd pass/$fiilename