Writes data to an open data file.
Exporting data from FileMaker Pro Advanced
•File ID is a numeric expression that specifies the file ID of an open data file. See Open Data File script step.
•Data source is the field or variable that contains the data to write to the file.
•Write as writes data to the file using FileMaker's default UTF-16 (little endian) character encoding or UTF-8. If the data source is container data, this option is ignored and data is written as binary.
•Append line feed adds a line feed character to the end of the data written to the file.
Product | Supported |
FileMaker Pro Advanced | Yes |
FileMaker Go | Yes |
FileMaker WebDirect | No |
FileMaker Server | Yes |
FileMaker Cloud products | Yes |
FileMaker Data API | No |
Custom Web Publishing | Yes |
Runtime solution | No |
FileMaker Pro 18.0 Advanced
Data at the read-write position in a file is overwritten by the data from Data source. See Set Data File Position script step.
The maximum amount of data this script step can write at a time is 64 MB. If the data to write is larger than 64 MB, you can perform this script step multiple times, writing an amount no larger than 64 MB each time.
•Performance is best when writing no more than 64 KB.
Writes the contents of a variable followed by a line feed as UTF-8-encoded text to the open data file with a file ID of 2.
Write to Data File [ File ID: 2 ; Data source: $variable ; Write as: UTF-8 ; Append line feed ]
Checks whether a file in the Documents folder named change.log exists, creates it if it doesn't exist, writes data from the Activity::Transaction field to the beginning of the file, and closes the file.
Set Variable [ $file ; Value: Get ( DocumentsPath ) & "change.log" ]
Get File Exists [ "$file" ; Target: $fileExists ]
If [ not $fileExists ]
Create Data File [ "$file" ; Create folders: Off ]
End If
Open Data File [ "$file" ; Target: $fileID ]
Write to Data File [ File ID: $fileID ; Data source: Activity::Transaction ; Write as: UTF-8 ; Append line feed ]
Close Data File [ File ID: $fileID ]
Writes data from a field to a specific position in the file named dates.txt. Before the script runs, the file contains 2024-11-30 and the Table::Month field contains 12. After the script runs, the file contains 2024-12-30.
Open Data File [ "dates.txt" ; Target: $fileID ]
Set Data File Position [ File ID: $fileID ; New position: 5 ]
Write to Data File [ File ID: $fileID ; Data source: Table::Month ; Write as: UTF-8 ]
Close Data File [ File ID: $fileID ]