Skip to end of metadata
Go to start of metadata

This function is used in Python Scripting.

Description

Takes a dataset and returns a new dataset with a one row altered. Datasets are immutable, so it is important to realize that this function does not actually change the row in the argument dataset. You'll need to do something with the new dataset that this function creates to achieve something useful.

To alter the row, this function takes a Python dictionary to represent the changes to make to the specified row. The keys in the dictionary are used to find the columns to alter. 

Client Permission Restrictions

This scripting function has no Client Permission restrictions.

Syntax

system.dataset.updateRow(dataset, rowIndex, changes)

  • Parameters

Dataset dataset - The starting dataset. Will not be modified (datasets are immutable), but acts as the basis for the returned dataset.

int rowIndex - The index of the row to update (starting at 0)

PyDictionary changes - A Dictionary of changes to make. They keys in the dictionary should match column names in the dataset, and their values will be used to update the row.

  • Returns

Dataset - A new dataset with the values at the specified row updated according to the values in the dictionary.

  • Scope

All

Code Examples
Code Snippet
# This example could be used to dynamically change the data that an Easy Chart displays. In this simple example, we assume that the chart is always configured to display a single tank's level. 
# This script would update the pen being displayed using a dynamic tank number.
 
# Generate new tag name and tag path
tankNumber = 5
newName = "Tank%d Level" % tankNumber
newPath = "Tanks/Tank%d/Level" % tankNumber
 
# Consolidate changes into a dictionary
updates = {"NAME": newName, "TAG_PATH":newPath}
 
# Update the Easy Chart
chart = event.source.parent.getComponent("Easy Chart")
newPens = system.dataset.updateRow(chart.tagPens, 0, updates)
chart.tagPens = newPens
  • No labels