FileMaker 18 added a number of long-requested features to their capabilities. You can now do some very cool data FileMaker 18 commands:
1. Create Data File:
Creates an empty, closed data file, to then open with the Open Data File script step and add data to using the Write to Data File script step.
2. Open Data File:
Opens a data file for use with other data file script steps.
3. Close Data File:
Closes an open data file.
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: “*” ]
4. Read from Data File:
Reads data from an open data file.
This script step reads data specified by Amount starting at the current read-write position, or it reads the entire file if Amount is not specified..
The maximum amount of data this script step can read at a time is 64 MB. If a file is larger than 64 MB, you can perform this script step multiple times, reading an amount no larger than 64 MB each time.
Options
•File ID is a numeric expression that specifies the file ID of an open data file. See Open Data File script step.
•Amount specifies the number of bytes to read if Read as is UTF-8 or Bytes. For UTF-16, Amount is the number of Unicode code units to read. If Amount is not specified (set to nothing), the entire file is read.
•Target is the field or variable to store the data read from the file.
•Read as specifies the character encoding of the file.
•UTF-16 is FileMaker’s default 16-bit Unicode (UTF-16 little endian) character encoding.
•UTF-8 is 8-bit Unicode character encoding.
•Bytes assumes no specific character encoding, but instead reads one byte at a time. If the target is a variable or container field, data read from the file is stored as container data with the same filename as the specified file.
Example 1
Reads the contents of an open file with a file ID of 2 and stores the data in a variable.
Read from Data File [ File ID: 2 ; Amount (bytes): ; Target: $variable ; Read as: Bytes ]
5. Write to Data File:
Writes data to an open data file.
6. Get File Exists:
Returns 1 (true) if a file exists; otherwise, returns 0 (false).
7. Get File Size:
Returns the size, in bytes, of a file.
8. Get Data File Position:
Returns the read-write position in an open data file.
9. Set Data File Position:
Sets the read-write position in an open data file.
Using these FileMaker 18 commands in combination with each other provides a lot of flexibility to the FileMaker developer who wants to incorporate outside files into his FileMaker controls.
[wpforms id=”7435″]