Reference > Script steps reference > Files script steps > Close Data File
 

Close Data File

Closes an open data file.

See also 

Options 

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

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 

Use this script step to close an open data file. For a list of the file IDs of all currently open data files, use the Get(OpenDataFileInfo) function. To close all open data files, set the File ID parameter to "*" (an asterisk surrounded by double quotation marks). All data files are closed when FileMaker Pro Advanced quits.

Example 1 

Closes the open data file with a file ID of 2.

Close Data File [ File ID: 2 ]

Example 2 

Closes all open data files.

Close Data File [ File ID: "*" ]

Example 3 

Opens a file, sets the file ID to a variable, reads the entire file, then closes the file using the same file ID.

Set Variable [ $file ; Value: "data.txt" ]
Open Data File [ "$file" ; Target: $fileID ]
Read from Data File [ File ID: $fileID ; Amount (bytes): ; Target: Table::Data ; Read as: UTF-8 ]
Close Data File [ File ID: $fileID ]

Related topics 

Open Data File script step

Script steps reference (alphabetical list)

Script steps reference (category list)