Adds a new field with a fixed value. The position of the new field within the table is set by the Field Index, using the appropriate integer value (0 onward, moving left to right). If Field Index is left blank, the new field will automatically be appended at the end of the existing dataset.
Example

Example Input
dim_A | dim_B | metric_1 |
AAA | DDD | 111 |
BBB | EEE | 222 |
CCC | FFF | 333 |
Example Output
dim_A | dim_B | NewFieldName | metric_1 |
AAA | DDD | new_value | 111 |
BBB | EEE | new_value | 222 |
CCC | FFF | new_value | 333 |
I Ain't Afraid of No Code!
[
[
"addfield",
{
"field": "NewFieldName",
"value": "new_value",
"index": 2,
"missing": null,
"_comment": null
}
]
]
param str field: Name of the field to be added.
param str value: Static value for new field.
param int index: Position of new field (first position = 0).
param str missing: Values for missing fields.
param str comment: A comment that will appear in the Transformation UI.
Comments
0 comments
Article is closed for comments.