Skip to main content
Version: 8.1

system.dataset.getColumnHeaders

This function is used in Python Scripting.

Description​

Takes in a dataset and returns the headers as a Python list.

Client Permission Restrictions​

This scripting function has no Client Permission restrictions.

Syntax​

system.dataset.getColumnHeaders(dataset)

Parameters​

TypeParameterDescription
DatasetdatasetThe input dataset.

Returns​

List - A list of column header strings.

Scope​

Gateway, Vision Client, Perspective Session

Code Examples​

Code Snippet
# This example fetches the dataset from a Vision table, and prints the table headers as a list.
# Fetch data from table component.
data = event.source.parent.getComponent('Table').data
# Print dataset headers.
print system.dataset.getColumnHeaders(data)
Code Snippet
# Fetch data from Power Table component.
data = event.source.parent.getComponent('Power Table').data

# Print dataset headers.
print system.dataset.getColumnHeaders(data)

# Convert list to a string
listAsString = ' '.join(system.dataset.getColumnHeaders(data))

# Print list as string
print listAsString

# Do something useful, such as write the string to a label component
event.source.parent.getComponent('Label').text = listAsString