← All nodes
Transformations

Limit / Head-Tail

Keeps only the first or the last so many rows and drops the rest.

When to use it

Use it for a top-N report after sorting, to cap what is sent to an output, or to work with a small slice of a big file while you build a flow.

In a pipeline

Settings

SettingTypeRequiredDefault or hint
Keepselect—top
Number of rowsnumber—100

Example

The three biggest customers

  • Keep=Top (first rows)
  • Number of rows=3
Customers, already sorted by revenue
CustomerRevenue
Northwind Trading98200
Harbour Foods76400
Cole & Sons51010
Bayside Deli9800
Result
CustomerRevenue
Northwind Trading98200
Harbour Foods76400
Cole & Sons51010

Worth knowing

  • The node keeps rows in the order they arrive — put a Sort Rows node in front of it for a real top or bottom N.
  • Asking for more rows than there are simply passes every row through.
  • Number of rows accepts a variable, e.g. $TopN, so a schedule can change the size without editing the flow.

Others in Transformations