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.
Options
- Specify File is the path of the data file to create. See Creating file paths.
- Create folders specifies whether to create new folders if they don't exist in the specified path.
Compatibility
Product | Supported |
FileMaker Pro | Yes |
FileMaker Go | Yes |
FileMaker WebDirect | No |
FileMaker Server | Yes |
FileMaker Cloud | Yes |
FileMaker Data API | No |
Custom Web Publishing | Yes |
Originated in version
18.0
Notes
- If the specified file already exists, this script step overwrites the file. To check whether a file exists first, use the Get File Exists script step.
Example 1
Creates an empty data file named data.txt if the path already exists.
Copy
Create Data File [ "data.txt" ; Create folders: Off ]
Example 2
Checks whether a file named change.log exists in the Documents folder and, if it doesn't, creates the file. If the file can't be created, the script displays an error code.
Copy
Set Error Capture [ On ]
Set Variable [ $file ; Value: Get ( DocumentsPath ) & "change.log" ]
Get File Exists [ "$file" ; Target: $fileExists ]
If [ $fileExists ]
Show Custom Dialog [ $file & ": Already exists" ]
Exit Script [ Text Result: ]
End If
Create Data File [ "$file" ; Create folders: Off ]
Set Variable [ $error = Get ( LastError ) ]
If [ $error = 0 ]
Show Custom Dialog [ $file & ": Created" ]
Else
Show Custom Dialog [ $file & ": Not created. Error code: " & $error ]
End If