Select Rows
Keeps the rows that pass your rules, sorted and limited.
@lainstack/data/select-rows · Data
How to use it
Section titled “How to use it”Use Select Rows to keep the rows of a list that pass your rules, sorted, and limited to the first few. For example, keep a customer’s earlier shipments that were approved, newest first, and keep 3, so a reader sees recent examples.
Good to know:
- Rows is a List of Records or a Table from an earlier step, such as Read Reference Table.
- Rows to use appears when each row holds a list of records, such as a read document’s packing list lines. Pick that list to work on its rows instead: the lines of every packing list become one list.
- Keep rows where takes rules, and a row is kept when all of them match. Each rule picks a Column, how it compares (Is), and a Value when the comparison needs one. The comparisons are the Condition block’s: equals, contains, greater than, before, and so on. Is empty and Is not empty work on every column, and treat a missing value, an empty text or an empty list as empty.
- Text compares without letter case, and equals ignores outer spaces, so “gbp “ keeps a “GBP” row. A Value is typed as text: type a number for a number column and a date as YYYY-MM-DD for a date column.
- A row without the column, or with an empty value, never passes a comparison that needs a value. A value that can’t be read, such as a date column holding “tomorrow”, stops the step and names the row.
- Sort by orders the kept rows by one text, number or date column, and Order picks the direction. Rows without a value go last. Limit then keeps the first rows.
- The Rows output is a Table when the rows came from a Table, ready for Write Reference Table, and a List otherwise. With no row left, it is empty.
Settings
Section titled “Settings”| Setting | Key | Type | Details |
|---|---|---|---|
| Rows (required) | rows |
Value | A List of Records or a Table from an earlier step. |
| Rows to use | rowsFrom |
List | Use the rows of a list inside each row, such as each packing list’s lines. At most 8 items. |
| Keep rows where | rules |
List | All rules must match. Leave empty to keep every row. At most 10 items. |
| Sort by | sortBy |
List | At most 8 items. |
| Order | order |
One of Smallest or oldest first, Largest or newest first |
|
| Limit | limit |
Number | The most rows to keep, after sorting. Empty keeps every row. |