User Manual

GETTING STARTED


OTHER EDITIONS


LAUNCHERS


MODULES


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

ALL USER MANUAL VERSIONS

Ignition 8.1. Offline Version (04/2021)
Ignition 8 Online Version
Ignition 7.9 Online Version
Ignition 7.8 Online Version

Deprecated Pages

SDK Documentation

Employees

Sign In

Skip to end of metadata
Go to start of metadata

This function is used in Python Scripting.

Description

This function is used to convert a PyDataset to a dataset. In addition it can also create new datasets from a raw Python list. When creating a new dataset, headers should have unique names. For more information on datasets and PyDatasets, see the Datasets page. 

Client Permission Restrictions

This scripting function has no Client Permission restrictions.

Syntax

system.dataset.toDataSet(dataset)

  • Parameters

PyDataset dataset - A PyDataset object to convert.

  • Returns

Dataset - The newly created dataset.

  • Scope

Gateway, Vision Client, Perspective Session

Syntax

system.dataset.toDataSet(headers, data)

  • Parameters

List[String] headers - The column names for the dataset to create.

List[Any] data - A list of rows for the new dataset. Each row must have the same length as the headers list, and each value in a column must be the same type.

  • Returns

Dataset - The newly created dataset.

  • Scope

Gateway, Vision Client, Perspective Session

Code Examples
Code Snippet - Create a simple dataset
# This example create a single column dataset.
header = ['myColumn']
rows = [[1], [2]]
dataset = system.dataset.toDataSet(header, rows)
Code Snippet - Converting Database Query Results into a Dataset
# This second example shows how this function can be used to convert from a PyDataSet (which is what system.db.runQuery returns) to a normal DataSet, which is the data type of a Table component's data property.
 
pyDataSet = system.db.runQuery("SELECT * FROM example1 LIMIT 100")
table = event.source.parent.getComponent("Table")
normalDataSet = system.dataset.toDataSet(pyDataSet)
table.data = normalDataSet
Keywords

system dataset toDataSet, dataset.toDataSet