Adds a field with an expression with the ability to access previous (prv) and next (nxt) rows as well. The expression will evaluate to NoneType if the next/previous row is not available (relevant for first/last row).
Example

Example Input
column_a | column_b | Column C |
a | 1 | 4 |
b | 2 | 5 |
c | 3 | 6 |
Example Output
column_a | column_b | Column C | new_column |
a | 1 | 4 | |
b | 2 | 5 | 6 |
c | 3 | 6 | 8 |
I Ain't Afraid of No Code!
[
[
"addfieldusingcontextx",
{
"subtable": null,
"field": "new_column",
"expression": "{cur.column_b} + {prv['Column C']}",
"_comment": null
}
]
]
param str subtable: Name a subtable in which output will be stored (will create subtable where necessary).
param str field: Name of the field to be added.
param str expression: Expression for new field. Use prv, cur and nxt as prefixes to access the previous, current and next row respectively.
param str comment: A comment that will appear in the Transformation UI.
Comments
0 comments
Article is closed for comments.