> For the complete documentation index, see [llms.txt](https://docs.avonnicomponents.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.avonnicomponents.com/flow/tutorials/components/data-table/learn-the-basics.md).

# Learn the Basics

Put an Avonni Data Table on a flow screen, feed it your open deals, label the columns, and use the rows the user ticks in the next flow element.

A sales manager opens a screen flow, sees every open opportunity in one table, ticks the deals that need a call this week, and clicks **Next**. The flow then writes "Call this week" on each ticked deal. This page builds that flow from an empty canvas. Most Data Table flows reuse the same pattern.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FUZoh99saLrKVeuxC7loq%2Fdata-table-tutorial-learn-the-basics-result.png?alt=media" alt="A flow screen with the Deals to review table: deal names as links, stage badges, amounts and close dates, two rows ticked and the line 2 items selected"><figcaption><p>The finished screen: open deals, two of them ticked for a call this week.</p></figcaption></figure>

## Before you start

* The Avonni Flow Components package is installed and your user has its permission set.
* You can create a screen flow in **Flow Builder**.
* A few open opportunities exist in the org, so the table has something to show.

## Steps

{% stepper %}
{% step %}

### Get the records in the flow

The table displays a collection your flow already holds. Add a **Get Records** element named `Get Open Deals`:

* **Object**: Opportunity
* **Filter**: **IsClosed** equals `False`
* **How Many Records to Store**: All records
* **How to Store Record Data**: choose the fields to keep (Name, Account ID, StageName, Amount, CloseDate) and store them in a new record collection variable, `OpenDeals`

If you would rather let the table fetch its own records, set its data source to **Query** in the **Properties** tab: [Group rows and show totals](https://docs.avonnicomponents.com/flow/tutorials/components/data-table/group-rows-and-show-totals.md) builds one.
{% endstep %}

{% step %}

### Add the Data Table to a screen

1. Add a **Screen** element after `Get Open Deals`.
2. In the screen's **Components** panel, search for `Avonni` and drag **Avonni Data Table** onto the screen.
3. Set its **API Name** to `DealsTable`. Every output you use later starts with this name.
4. Click **Open Component Builder**.
   {% endstep %}

{% step %}

### Point the table at your deals

A new Data Table starts on the **Variable** data source, with the **Fields** tab open on the left.

1. Set **Data Collection** to `OpenDeals`. The field list below it now shows the Opportunity fields.
2. Drag Name, StageName, Amount and CloseDate from the list onto the table preview. Each field becomes a column.

The preview shows the layout without your records. The rows arrive when the flow runs.

The table tells rows apart with its **Key Field** (**Properties** > **Data Mappings** > **Advanced Options**), the record `Id` unless you change it. Leave it on `Id`: the selection outputs and the row actions return that value.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FjSvwgrksdXz5035uVqHs%2Fdata-table-tutorial-learn-the-basics-builder.png?alt=media" alt="The Edit Data Table Component window: Data Collection set to Open Deals in the Fields tab, the column preview, and the Properties tab"><figcaption><p>Data Collection points the table at the flow's record collection.</p></figcaption></figure>
{% endstep %}

{% step %}

### Label and shape the columns

* To rename a column, hover its header and click the pencil (**Edit Column Label**). Use the words your users say: Deal, Stage, Amount, Close date.
* Each header also has a chevron that opens the column menu. **Type Attributes** sets how the values are drawn: set the Stage column's **Type** to **Badge**, and turn on **Linkify** on the Deal column so the name opens the opportunity ([details](https://docs.avonnicomponents.com/flow/tutorials/components/data-table/displaying-record-name-field-as-a-link.md)).
* **Remove Column** in the same menu deletes a column you no longer want.

In the **Properties** tab on the right, open the **Header** group and give the table a **Title** (`Deals to review`). Then turn on **Show Number of Items Selected** so the user sees how many rows are ticked. Click **Done**, then **Done** again to close the screen.
{% endstep %}

{% step %}

### Use the ticked rows after the screen

The Data Table hands the selection back to the flow as outputs of `DealsTable`. The two you need most:

* **Selected Rows** (`{!DealsTable.selectedRows}`): the ticked opportunities, as a record collection.
* **Number of Selected Rows** (`{!DealsTable.nbSelectedRows}`): how many were ticked.

After the screen:

1. Add a **Decision** `Any deal picked?`: outcome `Yes` when `{!DealsTable.nbSelectedRows}` is greater than `0`. The default outcome ends the flow.
2. On `Yes`, add a **Loop** over `{!DealsTable.selectedRows}`.
3. Inside the loop, an **Assignment**: set the loop variable's **NextStep** to `Call this week`, then **Add** the loop variable to a new record collection, `DealsToUpdate`.
4. After the loop, an **Update Records** on `DealsToUpdate`.

All the selection outputs, and how to limit or require a selection, are in [Work with Selected Rows](https://docs.avonnicomponents.com/flow/tutorials/components/data-table/work-with-selected-rows.md).
{% endstep %}

{% step %}

### Save and test

Save the flow and click **Debug**. The screen shows your open deals with the Deal column as links and the Stage column as badges. Tick two rows: the table shows "2 items selected". Click **Next**, then open the two opportunities: their **Next Step** field reads `Call this week`.
{% endstep %}
{% endstepper %}

## Prefer video?

{% embed url="<https://www.youtube.com/watch?v=AtXabU_86Ik>" %}

This walkthrough builds a Data Table in a screen flow from scratch. It was recorded on an earlier version of the Component Builder, so a few panels look different today; the steps above follow the current screens.

## Troubleshooting

<details>

<summary>The table is empty when the flow runs</summary>

The collection is empty at that screen. Check that `Get Open Deals` runs before the screen, that its filter matches records, and that **Data Collection** points at `OpenDeals`. The preview in the Component Builder never shows records, so an empty preview is normal.

</details>

<details>

<summary>A field I need is not in the field list</summary>

The list shows the fields of the collection's object. If a field is missing at runtime (the column stays blank), add it to the fields stored by the **Get Records** element.

</details>

<details>

<summary>Nothing is updated after the screen</summary>

The user ticked no row, or the Loop reads another output. Loop over `{!DealsTable.selectedRows}`. To stop the user from moving on without a selection, turn on **Required** (see [Work with Selected Rows](https://docs.avonnicomponents.com/flow/tutorials/components/data-table/work-with-selected-rows.md)).

</details>

## Related tutorials

* [Work with Selected Rows](https://docs.avonnicomponents.com/flow/tutorials/components/data-table/work-with-selected-rows.md): cap the number of ticked rows and use every selection output.
* [Data Table editor](https://docs.avonnicomponents.com/flow/tutorials/components/data-table/tips-and-tricks/data-table-editor.md): every gesture and column option of the preview.
* [Group rows and show totals](https://docs.avonnicomponents.com/flow/tutorials/components/data-table/group-rows-and-show-totals.md): group the deals by stage with a subtotal per group.
* [Quickstart Guide](https://docs.avonnicomponents.com/flow/getting-started/quickstart-guide.md): the same table plus a Visual Picker, placed on an account page.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.avonnicomponents.com/flow/tutorials/components/data-table/learn-the-basics.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
