Function
Custom JavaScript or Python transformation function that returns an updated row with optional lineage and audit metadata.
Parameters
- language (Language, string, optional) — JavaScript or Python. Omitted language is JavaScript. Switching does not translate source. Allowed values:
javascript,python. - function (Function Code, string, required) — JavaScript or Python function code. See JSON Configuration for signature and examples. Default:
"".
Field selection
- source — Field whose values this operation reads. Use a single field name, a comma-separated list of plain field paths (
cash_flow_type, currency) from the multi-select UI, or a regex via Pattern mode. Omit to apply to all fields on the row. - target — Optional output field. When omitted, the source field is updated in place. Hidden when more than one named source field is selected.
JSON Configuration
{ "id": "op-function", "type": "transformation", "action": "function", "params": { "language": "javascript", "function": "({ row }) => ({\n row: {\n ...row,\n total: row.price * row.quantity,\n },\n lineage: [\n {\n outputField: \"total\",\n inputFields: [\"price\", \"quantity\"],\n usage: \"transformation\",\n },\n ],\n})" }, "testInputs": [ "Hello World", "MixedCase", "sample text", "already", "123", "" ]}Write Python with params.language set to python (JS/Python control on the Function editor). Use def transform(ctx): and return {"row": …}. Import the Python standard library as needed, from fontana import Currency for money, and import pandas when the function uses pandas. On Operation nodes a Python function returns exactly one row per input row.
Python on Compute nodes
Section titled “Python on Compute nodes”On a Compute node the function still runs once per input row, and ctx["context"] is a dict that persists across every row of that operation. It starts empty for each operation and each run. Return one {"row": …}, a list of {"row": …} for several output rows, or [] for none. To aggregate, collect rows in context, return [] until ctx["rowIndex"] == ctx["numRows"] - 1, then return the summary rows.
def transform(ctx): acc = ctx["context"] acc.setdefault("rows", []).append(dict(ctx["row"])) if ctx["rowIndex"] < ctx["numRows"] - 1: return [] total = sum(r["amount"] or 0 for r in acc["rows"]) return [{"row": {"rows": len(acc["rows"]), "total": total}}]Each returned row traces back to the input row whose call returned it, so a summary returned on the last row traces to that row. A row whose function raises an error produces no output and is reported against that input row. One Python interpreter can hold at most 4 GiB, so keep only the fields you need in context; running out of memory stops the node with an error.