Set Data File Position

Sets the read-write position in an open data file.

Options 

  • File ID is a numeric expression that specifies the file ID of an open data file.
  • New position is a numeric expression that specifies the data file’s new read-write position.

Compatibility 

Product Supported
FileMaker Pro Yes
FileMaker Go Yes
FileMaker WebDirect No
FileMaker Server Yes
FileMaker Cloud products Yes
FileMaker Data API No
Custom Web Publishing Yes

Originated in version 

18.0

Description 

The read-write position is the number of bytes from the beginning of the file at which to start reading or writing data. At the beginning of a file, the read-write position is 0. At the end of a file, the position is the same as the file size (see Get File Size script step).

Notes 

Example 1 

Sets the read-write position of an open file with file ID of 2 to the value stored in a variable.

Copy
Set Data File Position [ File ID: 2 ; New position: $position ]

Example 2 

Writes the contents of the Utilities::Log Entry field to the end of the file named change.log that is in the Documents folder.

Copy
Set Variable [ $file ; Value: Get ( DocumentsPath ) & "change.log" ]
Get File Exists [ "$file" ; Target: $fileExists ]
If [ not $fileExists ]
    Exit Script [ Text Result: ]
End If
Get File Size [ "$file" ; Target: $fileSize ]
Open Data File [ "$file" ; Target: $fileID ]
Set Data File Position [ File ID: $fileID ; New position: $fileSize ]
Write to Data File [ File ID: $fileID ; Data source: Utilities::Log Entry ; Write as: UTF-8 ; Append line feed ]