Top  | Previous | Next

system.dataset.setValue

Description

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

Syntax

system.dataset.setValue(dataset, rowIndex, columnIndex, value)

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 set the value at (starting at 0)

int columnIndex - The index of the column to set the value at (starting at 0)

PyObject value - The new value for the specified row/column.

Returns

Dataset - A new dataset, with the new value set at the given location.

Scope

All

system.dataset.setValue(dataset, rowIndex, columnName, value)

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 set the value at (starting at 0)

String columnName - The name of the column to set the value at. Case insensitive.

PyObject value - The new value for the specified row/column.

Returns

Dataset - A new dataset, with the new value set at the given location.

Scope

All

Examples

This snippet could be used for a Button's actionPerformed event to change the selected cell's value in a Table component to zero.

 

table = event.source.parent.getComponent("Table")

selRow = table.getSelectedRow()

selCol = table.getSelectedColumn()

if selRow != -1 and selCol != -1:

   newData = system.dataset.setValue(table.data, selRow, selCol, 0.0)

   table.data = newData