# ExportData

ExportData automatically exports data in a spreadsheet cell to a Cell Data (.cxd) file according to a predetermined event in the spreadsheet. It allows you to export the data within a single cell on a vision system to one of the following locations:

- Flash memory of a local device
- FTP server
- SFTP server

When you export a .cxd file using the ExportData function Functions are tools that are available in Spreadsheet for processing and analyzing acquisitions or other results. You can add functions to your Spreadsheet job to create tool chains and produce results for specific applications., the data becomes a part of the ExportData function and cannot be edited. When you click on an exported .cxd file, the ExportData property sheet opens up, not the property sheet for the type of data that was exported. You can export the following data types:

- 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.
- TrainPatMaxRedLine: For more information, see TrainPatMaxRedLine.

CAUTION:

- Writing data from the ExportData function is a potential job A job is a user-configured program in In-Sight 3D Spreadsheet consisting of functions and designed for specific applications. You can create and edit jobs using the In-Sight 3D Spreadsheet interface, and load them on a vision system for deployment in a live environment. blocking function. Jobs can be slowed down and a vision system can queue or miss a trigger if the job takes longer to process than the trigger period.

Inputs

Syntax: ExportData(Event,Storage,Host Name,User Name,Password,File Path,File Name,Data to Export)

Parameter | Description
--- | ---
Event | Specifies the update event on which to read data. This parameter must be a reference to one of the following: The Image data structure in cell A1 . Note: If you write the data to a 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 Event parameter setting for the ExportData function is 0, and if the setting remains 0, an ExportData button is created next to the ExportData cell.
Storage | Specifies where the data is stored. There are three options: Local Device FTP Server SFTP Server
Host Name | Name/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 timeout. In-Sight Vision Suite can disconnect from the vision system if this occurs.
User Name | Specifies the user name that accesses the server. Only available when you select FTP/SFTP server as Storage.
Password | Specifies the password that accesses the server. Only available when you select FTP/SFTP server as Storage.
File Path | Specifies the data file path. If left blank, ExportData uses the default device directory. ExportData 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.
Data to Export | Cell reference to a data structure to export. If a cell contains a reference to another structure, such as a GetString reference, the tool exports the actual value contained in the cell.

Outputs

Returns | Creates a .cxd file that can be stored on an local device, or FTP/SFTP Server. Note: If ExportData returns an #ERR as a result, you can utilize GetErrorString to determine the cause.

ExportData exports the .cxd file when one of the following occurs:

- You press the OK button on the ExportData property sheet.

- The tool receives an Event.

- The Event parameter is ON (or points to a non-zero numeric value), and one of the ExportData input parameters is updated.

  Note: ExportData works in Offline mode as well.

## ExportData Example

ExportData(A8,"FTPServer1","operator1","","PartXPattern",H7)

Whenever the spreadsheet updates after an event is triggered in cell A8, the function writes the data in cell H7, as a file named PartXPattern.cxd, to the server named FTPServer1. The user name is specified as operator1, and the password is left blank.