ListToFileTool

The ListToFile tool allows you to save a list, which is transferred via the input terminal, in CSV or JSON files. You can select which properties of the list entries are to be taken into account.

Surface

../../../_images/tool.png

(1) Consider properties

First, you have to define which properties of the list entries should be taken into account.

Path: Path to the value (Cognex Terminal Format)

Header: In a CSV file, this is the column header. In a JSON file, this is the name of the property.

../../../_images/select-path.png

To take a new property into account, a new entry must be created. In the dialog that opens, the path to the considered property can now be selected, as with Cognex terminals.

(2) File settings

Directory: Directory to which the file will be written.

FileName: File name

Note

The full path is assembled from directory and filename. The directory is normally preconfigured, while the filename changes per run and is passed as input terminal.

(3) Result in case of error

Result On Error: What result should be returned by this tool if an error occurred?

Use Global Setting: WriteCsvToolResultOnError: If checked, this setting will be taken from Viper.NET. (To be found there under: Global Settings / VisionPro Tools)

(4) Format - CSV

Write Headers: Should the names of the columns be saved in the first line of the CSV file?

Delimiter: Which column delimiter should be used?

WriteMode: How to proceed with existing files?

  • Overwrite: The file is overwritten.

  • Append: The list is appended to the existing file.

(4) Format - JSON

JSON has no configuration

Note

Existing JSON files are always overwritten.

(5) Additional properties

../../../_images/additional-inputs.png

Sometimes it is necessary to assign a higher-level property to the individual data records, for example, in order to be able to assign them to the same run or component. For this purpose there are Additional Inputs. These work exactly like input terminals for tool blocks. Data can be defined or dragged onto the ListToFileTool via DataBinding. This data is added to each list entry.