Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Scripting_function


Panel
titleDescription

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

Note_friendly

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 permissions restrictions


Panel
titleSyntax

system.dataset.filterColumns(dataset, columns)

  • Parameters

Dataset | PyDataset dataset - The starting dataset.

List[Integer] | List[String] columns - A 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.

  • Scope

Gateway, Vision Client, Perspective Session

Panel
titleCode Examples
Code Block
languagepy
titleCode 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
Panel
titleKeywords

system dataset filterColumns, dataset.filterColumns