Search

User Manual

GETTING STARTED


MODULES AND PLATFORM


APPENDIX


TUTORIALS & HELPFUL TRICKS


STRATEGIC PARTNER LINKS

Sepasoft - MES Modules
Cirrus Link - MQTT Modules

RESOURCES

Inductive University
Ignition Demo Project
Knowledge Base Articles
Forum
IA Support
SDK Documentation
SDK Examples

ALL USER MANUAL VERSIONS

Ignition 8.1
Ignition 7.9
Ignition 7.8

Deprecated Pages

Employees

Sign In

Skip to end of metadata
Go to start of metadata

This function is used in Python Scripting.

Description

Formats the contents of a dataset as CSV (comma separated values), returning the resulting CSV as a string. If the "forExport" flag is set, then the format will be appropriate for parsing using the system.dataset.fromCSV function.

Client Permission Restrictions

This scripting function has no Client Permission restrictions.

Syntax

system.dataset.toCSV(dataset, showHeaders, forExport, localized)

  • Parameters

Dataset dataset - The dataset to export to CSV.

Boolean showHeaders - If set to true(1), a header row will be present in the CSV. Default is true(1).

Boolean forExport - If set to true(1), extra header information will be present in the CSV data which is necessary for the CSV to be compatible with the fromCSV method. Overrides showHeaders. Default is false(0).

Boolean localized - If set to true(1), the string representations of the values in the CSV data will be localized. Default is false(0).

  • Returns

String - The CSV data as a string

  • Scope

Gateway, Vision Client, Perspective Session

Code Examples
Code Snippet
# This snippet would run a SQL query against a database, and turn the results into a CSV string. It would then store the resulting CSV to a file on the local hard drive.
 
results = system.db.runNamedQuery("Fetch Records",{})
csv = system.dataset.toCSV(dataset = results, showHeaders = True, forExport = False)
filePath = "C:\\output\\results.csv"
system.file.writeFile(filePath, csv)
Keywords

system dataset toCSV, dataset.toCSV 

  • No labels