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
File InputScriptExport CSV
Settings
| Setting | Type | Required | Default or hint |
|---|---|---|---|
| Language | select | — | js |
| Code | textarea | Yes | JavaScript: 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 }));
| Id | Total |
|---|---|
| 1 | 120 |
| 2 | -5 |
| 3 | 40 |
| Id | Total | Big |
|---|---|---|
| 1 | 120 | true |
| 3 | 40 | false |
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.