Search code examples
filemaker

Export each record of found set to individual file?


This seems like such a simple operation normally, but I can't seem to make FileMaker cooperate.

What I want to do: 1) Loop through each found record, one at a time. 2) Export the contents of this record to a filename based on a field within the record.

Loop
    Set Variable[$path; Value:Get(FilePath) & "/../somefolder" & MyTable1::my_field_1]
    Export Records [No dialog; "$path"; Unicode(UTF-8)]
End Loop

This script, however, appends every record to the same file. They don't seem to offer an 'Export Record' (singular), so I'm not sure how else to accomplish this.

Any help would be greatly appreciated.


Solution

  • I was able to find a solution:

    Find All
    Go to Record/Request/Page [First]
    Loop
      Omit
      Find Omitted
      Set Field ["HTML File Name","External("DM-Export", KeyField & ".html")"]
      Export Records [Restore]
      Find All
      Go to Record/Request/Page [Exit After Last, Next]
    End Loop
    

    As per Step 7 on: http://help.filemaker.com/app/answers/detail/a_id/3438/kw/exporting%20found%20set