> 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/tips-and-tricks/how-to-set-column-visibity.md).

# How to Set Column Visibility

Show a Data Table column only to the right users, for example the Discount column for sales managers, with a Boolean formula in your screen flow.

Sales reps and sales managers run the same screen flow to review open deals. Managers need the Discount column to approve pricing. Reps should not be distracted by it. Instead of building two screens, you keep one Data Table and let a Boolean formula decide, when the screen loads, whether the Discount column is hidden.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FgvOopi8eiOQh3Aag9s16%2Fdata-table-tutorial-how-to-set-column-visibity-result.png?alt=media" alt="Data Table of opportunities with Name, Stage, Amount and Close Date columns and no Discount column"><figcaption><p>Without the View Discounts permission, the Discount column is hidden.</p></figcaption></figure>

## Before you start

* A screen flow with an Avonni Data Table that lists Opportunities, including a **Discount** column. If you are starting from scratch, follow [Learn the Basics](https://docs.avonnicomponents.com/flow/tutorials/components/data-table/learn-the-basics.md) first.
* The table uses the **Query** or **Variable** data source. See [Data Source](https://docs.avonnicomponents.com/flow/flow-components/data-table.md#data-source).
* A way to tell managers from reps. This tutorial uses a custom permission named `View_Discounts`, assigned to managers through a permission set. A profile, a role or a record field works the same way: only the formula changes.

## Steps

{% stepper %}
{% step %}

### Create the visibility formula

1. In Flow Builder, open the **Toolbox** and click **New Resource**.
2. Set **Resource Type** to **Formula**, **API Name** to `hideDiscount` and **Data Type** to **Boolean**.
3. Enter this formula:

```
NOT({!$Permission.View_Discounts})
```

The formula returns `true` for anyone without the permission, which is the value that hides the column.
{% endstep %}

{% step %}

### Map the Hidden attribute

1. Select the Data Table on the screen and click **Open Component Builder**.
2. On the **Properties** tab, in the **Data Mappings** section, open **Columns** and click the **Discount** column.
3. Next to **Hidden**, switch the value type to **Mapped** (the variable icon). **Mapped** takes one flow resource for the whole column, where the **Field Name** toggle of other settings reads a value per row ([the difference](https://docs.avonnicomponents.com/flow/flow-components/data-table.md#take-a-value-from-each-row)).
4. Pick the formula. The list shows `hideDiscount` as **Hide Discount**.
5. Click **Save** in the column popover, then **Done**.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2Fo47I9FmekYvUyu5pse9s%2Fdata-table-tutorial-how-to-set-column-visibity-hidden-mapped.png?alt=media" alt="Discount column settings with the Hidden attribute mapped to the hideDiscount formula, shown as Hide Discount" width="320"><figcaption><p>Hidden is mapped to the hideDiscount formula, which the picker shows as Hide Discount.</p></figcaption></figure>
{% endstep %}

{% step %}

### Save and test

Save the flow and run it twice:

* As a user without the permission set, the table shows Name, Stage, Amount and Close Date. There is no Discount column.
* As a user with the permission set, the Discount column appears after Close Date.

To test as another user from Flow Builder, use the **Debug** option to run the flow as another user, if your org allows it.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FcZgPKpHiZGlboijlhD8q%2Fdata-table-tutorial-how-to-set-column-visibity-visible.png?alt=media" alt="The same Data Table with a Discount column after Close Date"><figcaption><p>With the permission, the same screen shows the Discount column.</p></figcaption></figure>
{% endstep %}
{% endstepper %}

{% hint style="warning" %}
Hiding a column changes what the table displays, not what the flow can read. The Discount values are still in the records and in the table outputs, such as `selectedRows`. To keep a field away from a user, use field-level security.
{% endhint %}

## Other ways to drive visibility

**Hidden** accepts any Boolean resource of the flow. A few examples:

| Show the column when                | Boolean formula for Hidden                                                              |
| ----------------------------------- | --------------------------------------------------------------------------------------- |
| The user has a custom permission    | `NOT({!$Permission.View_Discounts})`                                                    |
| The user has a given profile        | `{!$Profile.Name} <> "Sales Manager"`                                                   |
| An earlier screen asked for details | `NOT({!showDetails})`, where `showDetails` is a Boolean variable set before this screen |

To hide a column for everyone (for example a key you need in the outputs but not on screen), turn **Hidden** on without mapping it.

## Troubleshooting

<details>

<summary>The formula does not appear in the Mapped picker</summary>

**Hidden** only accepts Boolean values. Open the formula resource and check that **Data Type** is **Boolean**, not Text.

</details>

<details>

<summary>The column is hidden for everyone, managers included</summary>

The logic is inverted: **Hidden** must be `true` for the users who should not see the column. Check the `NOT()` and that the permission set holding the custom permission is assigned to the manager.

</details>

## Related tutorials

* [How to conditionally color cells](https://docs.avonnicomponents.com/flow/tutorials/components/data-table/tips-and-tricks/how-to-conditionally-color-cells.md): style each cell from a formula field.
* [Customizing the badge color using a formula](https://docs.avonnicomponents.com/flow/tutorials/components/data-table/tips-and-tricks/customizing-the-badge-color-using-a-formula.md): show a field as colored badges.
* [How to grayscale header actions dynamically](https://docs.avonnicomponents.com/flow/tutorials/components/data-table/tips-and-tricks/how-to-grayscale-header-actions-dynamically-in-avonni-data-table.md): another setting driven by a flow formula.


---

# 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/tips-and-tricks/how-to-set-column-visibity.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.
