# Transform

> Apply several operations to a list in one node: filter it, reshape each item, group the items, or run your own JavaScript.

**Transform** applies a chain of operations to a list in one node. Each operation receives the result of the one before it, so you can, for example, keep only the open orders, reshape each one, then group them by customer. It's in the **Data** category of the **Add node** panel.

When you need only one operation, use its own node instead: [Filter](node-filter.md), [Map](node-map.md), or [Group by](node-group-by.md).

## Set up the node

1. Select **+** on the handle of the node it follows, then select **Data > Transform**.
2. In the properties panel, select **Edit transformation**.
3. In **Collection**, enter the list to transform, for example `$vars.scriptTask1.output`. The field expects an array.
4. Add the operations, in the order they should run:

   | Operation | What it does |
   |---|---|
   | **Add Filter** | Returns only the items that match the conditions you set. |
   | **Add Map** | Turns each item into a new shape, with the field mappings you define. |
   | **Add Group By** | Groups the items by a field, and computes a count, sum, or average for each group. |
   | **Add Custom Script** | Runs your own transformation logic in JavaScript. |

5. Select **Run** to test the node, and check the result in the **Output** column.

## Output

The node returns the result of the last operation as `output`. Later nodes read it as `$vars.<nodeId>.output`, for example `$vars.transform1.output`.

## Transform or Script

Use **Transform** when the work is filtering, reshaping, or grouping a list. Use [Script](node-script.md) when the logic doesn't fit these operations. Within Transform, **Add Custom Script** covers a single step that needs code.

## Common issues

| Issue | Resolution |
|---|---|
| **Collection** shows an error | The field is required, and it expects an array. Check the value in the execution trace of the node that produces it. |
| The output is empty after a filter | The conditions don't match any items. Check the field names and values of the input in the execution trace. |
| The output has `undefined` fields after a map | The source field doesn't exist in the input items. Check the input structure in the execution trace. |

## Next steps

- [Filter](node-filter.md), [Map](node-map.md), and [Group by](node-group-by.md): one operation per node.
- [Variables and data flow](variables-and-data-flow.md): how `$vars` references work.
