Import Records
Imports records from a specified file or data source.
Options
-
With dialog specifies whether to display import-related dialog boxes when the script step is performed. However, if a data source file has not been specified, the Open File dialog box is displayed when a script is run.
-
Specify data source specifies the file or source of the data to be imported. Depending on the file or source you choose, a dialog box may appear for specifying the following additional options:
-
Specify import order defines whether to add, update, or replace records in the current found set, and how source fields are mapped to target fields when this script step runs. See Setting the import action and mapping fields during import.
Note When import source fields and target fields are mapped using matching names, field name matching is performed dynamically each time the script step is performed.
-
Verify SSL Certificates verifies the SSL certificate of the server specified in an HTTP request for XML data. If the certificate cannot be verified, users can choose to connect anyway or cancel to skip this script step. If the certificate cannot be verified and the Set Error Capture script step is set to On, this script step behaves as if the server were unavailable.
When you choose this file or source |
Do this |
File |
In the Specify File dialog box, choose the file you want to import, or type file paths directly into the list. Specify one path per line. FileMaker Pro will use the first path it locates as the file to import. See Creating file paths. If the First Row Option dialog box appears after you specify a data source, you can specify whether to use the first row as field names. However, if you use the Specify import order option, you can choose any record to use as field names when importing from certain file formats indicated in Supported import/export file formats. If you specify a file with a custom field delimiter in the Specify File dialog box, for File Type, choose Custom-Separated Values, and specify the field delimiter. |
Folder |
In the Folder of Files Import Options dialog box, choose the folder of image or text files that you want to import, or type the folder paths directly into the list. Specify one path per line. FileMaker Pro will use the first path it locates as the folder to import. See Importing a folder of files all at once and Creating file paths. This option is not supported in FileMaker WebDirect and server-side scripts. |
XML Data |
In the Specify XML and XSL Options dialog box, choose the source of the XML data that you want to import, and choose an XSLT style sheet if you want to apply one prior to import. The XML and XSLT source may be a file, the result of an HTTP request, or a calculation that generates a file path or an HTTP request. See Importing XML data. |
ODBC Data |
Specify the data source name and location, the user ID and password (if any), and the SQL query to be executed. See Automating ODBC import using the Import Records script step. SQL statements are limited to a maximum length of 256 K characters (512 KB). Note If you use the Import Records script step to import ODBC data that contains Unicode strings, your ODBC driver must support Unicode. Otherwise, the results may be inconsistent. |
Compatibility
Product | Supported |
FileMaker Pro | Yes |
FileMaker Go | Partial |
FileMaker WebDirect | Partial |
FileMaker Server | Partial |
FileMaker Cloud | Partial |
FileMaker Data API | No |
Custom Web Publishing | No |
Originated in version
6.0 or earlier
Description
You can set the import order and use the Specify import order option, or perform this script step with the dialog box so the user can set new criteria, such as importing data as a new table.
If the source file is open, the found set is imported; if not, all records in the source table are imported.
If you include this script step in a server-side script and you set With dialog to On, the option is dimmed; however this script step will run. The behavior will be the same as if With dialog is Off. See Get(DocumentsPathListing) function for more information.
Running a server-side script to do any of the following returns an error:
-
importing records to new table
-
importing records from a folder
-
importing images to a container field
See Importing data into FileMaker Pro.
Notes
-
In FileMaker Go:
-
Importing only from FileMaker Pro, comma-separated values, tab-separated values, DBF, and merge file formats is supported.
-
Importing to a new table is not supported.
-
-
In FileMaker WebDirect:
-
This script step is not supported in mobile browsers.
-
The Specify data source option is not supported. Users must specify a file accessible by the web browser.
-
Importing only from FileMaker Pro, comma-separated values, tab-separated values, DBF, merge, and Excel file formats is supported.
-
-
Server-side scripts can access only certain folders. See Paths in server-side scripts.
-
Server-side scripts, FileMaker Go, and FileMaker WebDirect support the following options only if With dialog is set to Off:
-
source files in custom-separated values format
-
any row as field names; if With dialog is set to On, only the first row can be specified
-
performing auto-enter options for individual fields
In FileMaker WebDirect, if these options are predefined in this script step and With dialog is set to On, options users choose when the script runs override the predefined options.
-
-
In the Specify data source option, if you specify a variable,
-
To specify a variable file path when you choose the Specify data source option and then the Specify import order option, place the variable first in the file path list followed by a path to a local file in the format you want to import. When you choose the Specify import order option, the script step uses the first file path that it can locate. Because the script step can't evaluate the variable until the script runs, it uses the next file path in the list (the local file), which enables you to choose options. However, when the script runs, the script step uses the file path defined by the variable, if the variable can be evaluated.
If you specify only a variable and don't want to use Specify import order options, then the First Row Option dialog box displays to let you choose whether the first row contains field names.
Example 1
Imports information from New Product Catalog.xlsx as new records without prompting the user.
Go to Layout [ "Products" (Products) ; Animation: None ]
Import Records [ With dialog: Off ; Table: Products ; Source: "New Product Catalog.xlsx" ; Worksheet: "Stock" ; Add ; Mac Roman ]
Example 2
Replaces existing records with information from New Product Catalog.xlsx.
Go to Layout [ "Products" (Products) ; Animation: None ]
Sort Records [ Restore ; With dialog: Off ]
Go to Record/Request/Page [ First ]
Import Records [ With dialog: Off ; Table: Products ; Source: "New Product Catalog.xlsx" ; Worksheet: "Stock" ; Replace ; Mac Roman ]
Example 3
Sets the next serial value after importing records. This is useful when Perform auto-enter options during import is not selected to preserve dates and other auto-entries.
Go to Layout [ "Products" (Products) ; Animation: None ]
Import Records [ With dialog: Off ; Table: Products ; Source: "New Product Catalog.xlsx" ; Worksheet: "Stock" ; Add ; Mac Roman ]
Set Next Serial Value [ Products::Product ID ; Get ( TotalRecordCount ) + 1 ]
Sort Records [ Restore ; With dialog: Off ]
Go to Record/Request/Page [ First ]