Table.set
setvalueasset_modeon_problems
Group: Values
Aliases: add column, new column, update column
Documentation
Adds or updates a column on the table.
Arguments
value: The value, expression or column to create column.as: Optional new name for the column.set_mode: Specifies the expected behaviour in regards to existing column with the same name.on_problems: Specifies how to handle problems with expression evaluation.
Examples
Create a table where the values of the total stock in the inventory is
doubled.
import Standard.Examples
example_set =
table = Examples.inventory_table
double_inventory = table.at "total_stock" * 2
table.set double_inventory as="total_stock"
table.set (expr "2 * [total_stock]") as="total_stock_expr"
Errors
- If the column name is already present and
set_modeisAdd, aExisting_Columndataflow error is raised. - If the column name is not present and
set_modeisUpdate, aMissing_Columndataflow error is raised. - If a column name referenced from within an expression cannot be found,
a
No_Such_Columndataflow error is raised. - If the provided expression is invalid, a corresponding
Expression_Errordataflow error is raised. - The following problems with expression evaluation may be reported
according to the
on_problemssetting: - If the expression checks equality on a floating-point column, a
Floating_Point_Equality. - If an arithmetic error occurs when computing the expression, an
Arithmetic_Error. - If more than 10 rows encounter computation issues, an
Additional_Warnings.