ADD COLUMN BY EXPRESSION¶
Appends a new computed column to a dataset by evaluating a user-supplied expression against existing columns. Use this worker when you need to derive a calculated field (e.g., unit conversions, arithmetic combinations, conditional logic) inline within a workflow without writing custom code.
When to use¶
Classification: process.
Tagged: column, dataset, derived_field, expression, process, transform.
Inputs¶
| Label | ID | Type | Default | Required | Description |
|---|---|---|---|---|---|
| Dataset | dataset | dataset | — | Input dataset (tabular) to which the new computed column will be appended; accepts any d3VIEW dataset object passed from an upstream worker. | |
| New Column name | new_columnname | text | — | Name of the new column to create; must be a valid string identifier that does not conflict with existing column names in the dataset. | |
| Expression | expression | text | — | Mathematical or logical expression (e.g., ‘col_a * 2 + col_b’) evaluated row-wise to produce values for the new column; reference existing column names as variables. | |
| Substitution Safety | substitution_safety | list | legacy | Controls how column-name substitution is performed before the expression is evaluated. ‘legacy’ (default) preserves the original bare-regex behaviour for backward compatibility. ‘word_boundary’ wraps each column-name regex with word boundaries plus preg_quote so single-letter names (e.g. ‘E’) don’t match inside numeric literals like 6.86e-6 or substrings of values from other columns. ‘numeric_safe’ formats numeric row values via sprintf(‘%.17g’) before substitution so values never carry a stray ‘E’ from scientific notation. ‘both’ applies both protections — recommended for new workflows; covers the DW-2913 ‘no-value’ case where a tiny Yield_Strain rendered as 6.86E-6 collided with a column named ‘E’. |
Outputs¶
| Label | ID | Type | Description |
|---|---|---|---|
| dataset_add_column_by_expression_output_1 | dataset_add_column_by_expression_output_1 | dataset | A copy of the input dataset with the newly computed column appended as the last column, preserving all original rows and columns. |
Disciplines¶
- data.dataset.transform
Runnable example¶
A runnable example is registered for this worker. Open the example workflow on the d3VIEW canvas: /api/workflow/example?id=dataset_add_column_by_expression
Auto-generated from transformation schema. Worker id: dataset_add_column_by_expression. Schema hash: 1d165c560bf7. Hand-curated docs in workerexamples/ override this page when present.