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

Get Data File Position

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

See also 


File ID is a numeric expression that specifies the file ID of an open data file.

Target is the field or the variable to store the opened data file's read-write position. If the variable doesn't exist, this script step creates it (see Using variables).





FileMaker Pro Advanced 


FileMaker Go 


FileMaker WebDirect 


FileMaker Server 


FileMaker Cloud products 


FileMaker Data API 


Custom Web Publishing 


Runtime solution 


Originated in 

FileMaker Pro 18.0 Advanced


When a data file is first opened, the read-write position is 0. After a file is read from or written to, the read-write position moves to the point after the data that was read or written. See Set Data File Position script step.

Example 1 

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

Get Data File Position [ File ID: 2 ; Target: $position]

Example 2 

Creates a file named change.log, writes the contents of the Products::Status field to the file, then displays the read-write position. If the field contains Completed, the result displayed is Current read-write position: 9, which is after the last byte that was written.

Set Variable [ $file ; Value: "change.log" ]
Create Data File [ "$file" ; Create folders: Off ]
Open Data File [ "$file" ; Target: $fileID ]
Write to Data File [ File ID: $fileID ; Data source: Products::Status ; Write as: UTF-8 ]
Get Data File Position [ File ID: $fileID ; Target: $position ]
Show Custom Dialog [ "Current read-write position: " & $position ]
Close Data File [ File ID: $fileID ]

Related topics 

Open Data File script step

Write to Data File script step

Script steps reference (alphabetical list)

Script steps reference (category list)