Skip to main content
Version: 8.1

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.

note

Datasets are immutable, which means they cannot be directly modified once created. Instead, this scripting function returns a new dataset with some modification applied, which must be assigned to a variable to be used. See Altering a Dataset.

Client Permission Restrictions

This scripting function has no Client Permission restrictions.

Syntax

system.dataset.filterColumns(dataset, columns)

Parameters

TypeParameterDescription
Dataset / PyDatasetdatasetThe starting dataset.
List[Integer] / List[String]columnsA 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. If a value passed to this parameter is not in a list, then an empty dataset will be returned.

Returns

Dataset - A new dataset containing the filtered columns. The order of columns in this dataset is determined by the column order provided to the columns parameter.

Scope

Gateway, Vision Client, Perspective Session

Code Examples

Code Snippet
# This example takes the dataset from a two 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

north = [0, 1] # Label and North Area columns (using column index)
south = ["Label", "South Area"] # Label and South Area columns (using column names)

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

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

Keywords

system dataset filterColumns, dataset.filterColumns