# --Manage Column Visibility

## Overview

In the [**Avonni Data Table**](/dynamic-components/components/data-table.md), you don't have to show every column all the time. Using the **Hidden attribute**, you can create a "Smart UI" that automatically reveals or hides columns based on specific data conditions or business rules.

This tutorial moves beyond simple permissions and shows you how to use Contextual Visibility to keep your interface clean and focused.

***

## General Concept

Column visibility is controlled by a Boolean (True/False) formula. This formula acts as a toggle for the "Hidden" property:

* **If Formula** = `true`: The column is **Hidden**.
* **If Formula** = `false`: The column is **Visible**.

> Note: It helps to think of this as the "Hide Condition." If the condition is met, the column disappears

***

## Use Case: Conditional "Discount Justification"

Imagine you have an Opportunities table. You allow sales reps to offer discounts, but if a discount exceeds 15%, company policy requires them to complete a "Justification" field.

To keep the table clean, you want the **Justification** column to be **hidden** for standard deals and visible only when a high discount is entered.

### Guided Steps

{% stepper %}
{% step %}

#### Create the formula

On your Dynamic Component, create a formula variable of type boolean. This formula will evaluate to true or false and serve as the condition for the Hidden attribute. If the formula returns true, the column will be hidden; if it returns false, the column will be displayed.

In this example, we want to hide the column for users whose profile is not System Administrator or Sales Manager. Here’s the formula syntax:

```
NOT(
    OR(
        $Profile.Name = "System Administrator",
        $Profile.Name = "Sales Manager"
    )
)
```

This formula returns ‎`true` (so the column is visible) when the current user’s profile is System Administrator or Sales Manager, and ‎`false` (so the column is hidden) for all other profiles

{% hint style="success" %}

#### Pro Tip

To check that your formula works as expected, add a **Text element** to your Dynamic Component and bind it to the formula variable you just created. The Text element will display the formula’s result in real time, making it easy to confirm that the value is correct.
{% endhint %}
{% endstep %}

{% step %}

#### Map the formula

Map this Boolean formula variable to the Hidden attribute of the margin column in the Data Table.
{% endstep %}

{% step %}

#### Save and test

Save your changes, then open the table as a System Administrator and as another profile to confirm that the margin column behaves as expected
{% endstep %}
{% endstepper %}


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.avonnicomponents.com/dynamic-components/tutorials/components/data-table/manage-column-visibility.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
