# Look up a row in a table

> Finds the row in one of your tables that matches, and brings its columns into the steps after it.

Source: https://docs.go-lumen.ai/reference/steps/find-row

## At a glance

| Property | Value |
| --- | --- |
| **Step name** | `find-row` |
| **Resource** | ClusterStep (`lumen.ai/v1alpha1`) |
| **Palette group, category** | read, tables |
| **Credits** | **1** credit each time it succeeds |
| **Side effects** | no |
| **Installation must provide** | nothing |

## Inputs

| Property | Value |
| --- | --- |
| **Needs** | nothing |
| **Produces** | `fields` |
| **Works on** | item: one document at a time |

Needs and Produces are data types (file, text, fields, email). The editor offers a step only where what it needs is already on the path. See [Documents and data](https://docs.go-lumen.ai/concepts/how-flows-run.md#documents-and-data).

## Outputs

A later node references an output as `{nodeId.field}` in text, or `nodeId.field` in a condition.

| Output | Type |
| --- | --- |
| `found` | boolean |
| `count` | number |
| `rowId` | string |
| `rows` | array |
| `truncated` | boolean |

More outputs are declared in the setting `returns`.

## Settings

Set under `config:` on the flow node. Text settings may contain `{nodeId.field}` placeholders.

| Setting | Type | Default | Description |
| --- | --- | --- | --- |
| `sheet` (required) | string |  | Name of the table to look the row up in. (minLength 1) |
| `base` | string |  | Name of the base (database) the table is in. Optional: when set, the table must belong to this base. (minLength 1) |
| `where` (required) | list of object |  | Where are the tests a row must all pass. (minItems 1; maxItems 8) |
| `where[].column` (required) | string |  | (minLength 1) |
| `where[].op` | string | `"eq"` | Op is eq (the default), contains (text, case-insensitive), or gt, gte, lt, lte (numbers, amounts and dates). (one of eq, contains, gt, gte, lt, lte) |
| `where[].value` (required) | string |  |  |
| `all` | boolean |  | All brings back every match, up to limit, as the list field rows. The first match is always the fields. |
| `limit` | integer |  | Limit is how many rows all brings back; 50 when unset, 10000 at most. When more rows match, the output truncated is true. (minimum 1; maximum 10000) |
| `prefix` | string |  | Prefix goes before each column name in the fields, so a looked-up value does not replace a field of the same name. (maxLength 32) |
| `returns` | list of object |  | Returns lists the columns later steps will use, so the editor can offer them. All of the row's columns are brought back either way. (maxItems 100) |
| `returns[].name` (required) | string |  | (minLength 1) |

The full JSON Schema of these settings: [find-row.schema.json](https://docs.go-lumen.ai/schemas/steps/find-row.schema.json).

## Example

Look up a supplier by name

```yaml title="config"
returns:
- name: contact
- name: city
- name: status
sheet: Suppliers
where:
- column: name
  op: eq
  value: '{supplier}'
```

## Use it in a flow

A node that runs `find-row` goes under `spec.nodes` of a [Flow](https://docs.go-lumen.ai/concepts/how-flows-run.md#the-flow-as-yaml). Give it any id, and list the next node ids in next.

```yaml title="flow.yaml"
apiVersion: lumen.ai/v1alpha1
kind: Flow
metadata:
  name: find-row-example
  namespace: tenant-acme
spec:
  displayName: "Look up a row in a table"
  triggers:
    - id: start
      ref: {name: manual-run}
      next: [find-row]
  nodes:
    - id: find-row
      stepRef: {name: find-row}
      config:
        returns:
        - name: contact
        - name: city
        - name: status
        sheet: Suppliers
        where:
        - column: name
          op: eq
          value: '{supplier}'
```
