Reference > Script steps reference > Files script steps > Set Data File Position
 

Set Data File Position

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

See also 

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 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 

Originated in 

FileMaker Pro 18.0 Advanced

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 

If you specify a negative value for New position, the Get(LastError) function returns an error.

Example 1 

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

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.

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 ]

Related topics 

Open Data File script step

Script steps reference (alphabetical list)

Script steps reference (category list)