Skip to main content
Version: 7.9

system.dataset.filterColumns

This function is used in Python Scripting.

Description

Takes a dataset and returns a view of the dataset containing only the columns found within the given list of columns.

Client Permission Restrictions

This scripting function has no Client Permission restrictions.

Syntax

system.dataset.filterColumns(dataset, columns)

Parameters

TypeParameterDescription
DatasetdatasetThe starting dataset.
PySequencecolumnsA list of columns to keep in the returned dataset. The columns may be in integer index form (starting at 0), or the name of the columns as Strings.

Returns

Dataset - A new dataset containing the filtered columns.

Scope

All

Code Examples

Example 1

# This example takes the dataset from a five column Bar Chart and displays a subset of the data in two separate tables. This is performed in a button component actionPerformed script.

chartData = event.source.parent.getComponent('Bar Chart').data

northSouth = [1, 2] # North Area, South Area cols
eastWest = ["East Area", "West Area"]

filteredData = system.dataset.filterColumns(chartData, northSouth)
event.source.parent.getComponent('NorthSouthTable').data = filteredData

filteredData = system.dataset.filterColumns(chartData, eastWest)
event.source.parent.getComponent('EastWestTable').data = filteredData