# ImportData

The ImportData function imports Cell Data (.cxd) files exported with the ExportData function, cell by cell, from one of the following locations:

- Flash memory of a local vision system

- FTP server

- SFTP server

ImportData automatically inserts a .cxd file into the spreadsheet according to a predetermined event.

Note: The ImportData function cannot import .cxd files from the Snippets folder on the PC.

When you import a .cxd file, the data becomes part of the ImportData function and cannot be edited. When you click on an imported .cxd file, the ImportData property sheet opens and not the property sheet for the data type that was imported.

You can import the following data types:

- DelayLine: For more information, see DelayLine.
- CountPassFail: For more information, see CountPassFail.
- Calibrate: For more information, see Calibrate.
- CalibrateGrid: For more information, see CalibrateGrid.
- ExtractCalibration: For more information, see ExtractCalibration.
- OCRMax: For more information, see OCRMax.
- OCRMaxSettings: For more information, see OCRMaxSettings.
- ShiftRegister: For more information, see ShiftRegister.
- TrainPatMaxPattern: For more information, see TrainPatMaxPattern.
- TrainPatMaxRedLine: For more information, see TrainPatMaxRedLine.

## ImportData

Inputs

Syntax: ImportData(Event,Host Name,User Name,Password,File Name)

Parameter | Description
--- | ---
Event | Specifies the update event on which to import data. This parameter must be a reference to one of the following: The image data structure in cell A0 , containing the AcquireImage function. For more information, see AcquireImage. Note: If you write the data to flash memory and the Event is set to the Image data structure, the function returns an #ERR. A cell containing an Event function. For more information, see Event. A cell containing a Button function. For more information, see Button. Note: The default setting of the Event parameter for the ImportData function is 0. When the parameter is 0, an ImportData button is created next to the ImportData cell.
Storage | Specifies where the data is stored. You have the following options: Local Device FTP Server SFTP Server
Host Name | Name or IP address of the server where you save the file. Only available when you select FTP/SFTP server as Storage. Note: If the server is unavailable at the time of the data transfer, it takes several seconds to time out. In-Sight Spreadsheet can disconnect from the vision system if this occurs.
User Name | Specifies the username accessing the server. Only available when you select FTP/SFTP server as Storage.
Password | Specifies the password accessing the server. Only available when you select FTP/SFTP server as Storage.
File Path | Specifies the data file path. If left blank, ImportData uses the default device directory. ImportData supports all valid absolute or relative PC paths.
File Name | Specifies a custom name for the file. If the file name already exists on the target location, the existing file is overwritten. Note: Do not enter a file extension. It is automatically added to the string.

Outputs

The imported data corresponds to the data structure contained in the exported cell. For example, if an integer is imported, the cell displays the integer value; if a Calib structure is imported, the cell displays the Calib structure. However, if you double-click on the Calib structure, the ImportData property sheet opens and not the Calib structure property sheet.

ImportData imports a .cxd file when one of the following occurs:

- You click the OK button on the ImportData property sheet.
- The tool receives an Event.
- The ImportData Event parameter is ON (or points to a non-zero numeric value), and any one of the ImportData input parameters is updated.
- You load a job with an ImportData function.

Note: ImportData works in Offline mode as well.

## ImportData Example

ImportData(A0,"192.168.0.100","admin","",

Whenever the spreadsheet updates after an image capture, the function imports the data as a file called PartXPattern.cxd from the server with the IP address 192.168.0.100. The user name is admin and the password is left blank.