← All nodes
Automation

Script

Transforms the rows with your own JavaScript or Python, run in a sandbox with no file, network or process access, a time limit and a memory limit.

When to use it

Use it as a last resort, for the 30-line step no combination of nodes covers. A node is easier to read, check and preview.

In a pipeline

Settings

SettingTypeRequiredDefault or hint
Languageselect—js
CodetextareaYesJavaScript: return rows.filter((r) => r.Total > 0); Python: rows = [r for r in rows if r["Total"] > 0]
Time limit (seconds)number—30

Example

Keep positive totals, add a flag

  • Language=JavaScript
  • Code=return rows.filter((r) => r.Total > 0).map((r) => ({ ...r, Big: r.Total > 100 }));
Orders
IdTotal
1120
2-5
340
Returned by the script
IdTotalBig
1120true
340false

Worth knowing

  • JavaScript: the code receives rows (a list of objects) and must return the rows to pass on. console.log lines show in the node's note.
  • Python: the code finds rows (a list of dicts) and leaves the rows to pass on in rows — or a pandas DataFrame, when the server has pandas. print() lines show in the note.
  • No files, network, other programs or environment variables are reachable, and eval / Function are off. Use input nodes to bring data in.
  • Administrators can turn scripts off for the whole server with FLOWDOO_SCRIPTS=off.

Others in Automation