> For the complete documentation index, see [llms.txt](https://docs.valorx.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.valorx.com/valorx-wave/wave-data-management/managing-grid-data/rule.md).

# Rule

Rules allow you to apply visual formatting and interactive behavior to grid data based on user-defined conditions. With **Rule**, you can highlight values, hide data, restrict editing access, and provide contextual cues all directly from within the grid interface.

Rules are available for both **Grid** and **Matrix**, using the same Rule Setup interface. Matrix-specific behavior — field selection, available actions, and field-combination rules — is called out separately below.

***

## Setup a Rule

To create a rule:

1. Click the **Rule** button in the toolbar.
2. Click the **Add Rule** button.
3. Enter a **Rule Name**.
4. Define your condition(s) and apply condition logic in the **When** section.
   * Condition logic (AND/OR) is applicable when you add two or more conditions.
5. Choose the formatting or behavior in the **Then** section.
6. Optionally, add a **Legend** to help users understand the rule’s purpose.
7. Click **Apply** to create the rule.
8. Click **Apply** again to activate and apply the rule to the grid.

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FXtcaHM9hUm4N1ALTQ6MB%2FRule%20v3.gif?alt=media&amp;token=f91beb66-b527-4021-b360-01345a425194" alt=""><figcaption><p>Rule Setup for Grid</p></figcaption></figure>

***

## Conditions (When Section)

The **When** section defines the logic for when a rule should apply. You can create one or more conditions using supported fields and operators.

### Column Selection: Grid vs. Matrix

#### Grid:

* The Column dropdown **lists all fields** on the grid's object.<br>

  <figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FA2kpzgq58ytzkv3VeKHF%2Fimage.png?alt=media&amp;token=5311ec2f-4098-41a6-b405-39a78509f0b1" alt=""><figcaption><p>Column Selection for Grid</p></figcaption></figure>

#### Matrix:

* The Column dropdown **groups fields by axis**:
  * Y-Axis fields
  * X-Axis fields
  * Data fields

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FB9Ia4utV7Y9chVBbPV4z%2Fimage.png?alt=media&amp;token=f9365467-b241-442d-9d0d-0a980640d602" alt=""><figcaption><p>Column Selection for Matrix</p></figcaption></figure>

The condition can reference any field from any axis, but the axis(es) selected determine which actions are available in the [Then (action) ](#actions-then-section)section. See Matrix Field Combinations below.

### Supported Logic

* **AND logic**: All conditions must be true
* **OR logic**: At least one condition must be true
* **Nested logic supported**: For example, `(Condition A AND Condition B) OR Condition C`
* **Note**: You cannot use both **AND** and **OR** at the same level — for example, `Condition A AND Condition B OR Condition C` is **not supported** unless properly nested.

### Example Conditions

* `Additional Discount > 20`
* `Final Amount < 1000`
* `Scheduled Date < Today`

Blank cells are excluded from logic evaluations. Zero (0) is treated as a valid numeric value.

***

## Then (action)

The **Then (action)** section defines what happens when the condition(s) are met. Each rule supports one or more actions, depending on the selected columns or rows.

<table data-search="false"><thead><tr><th width="156">Action Type</th><th width="158">Applies To</th><th width="312">Description</th><th>Available In</th></tr></thead><tbody><tr><td>Cell Format</td><td>Specific columns</td><td>Make a cell Read Only or Hidden</td><td>Grid, Matrix</td></tr><tr><td>Cell Highlight</td><td>Specific columns</td><td>Apply visual highlight (Dot/Bar/Fill)</td><td>Grid, Matrix</td></tr><tr><td>Column (X-Axis) Format</td><td>X-Axis column</td><td>Make the column Read Only or Hidden. This applies to all data cells under that X-axis column</td><td>Matrix only</td></tr><tr><td>Column (X-Axis) Highlight</td><td>X-Axis column</td><td>Apply visual highlight (Bar/Dot/Fill) to all data cells under that X-axis column</td><td>Matrix only</td></tr><tr><td>Row Read Only</td><td>Entire row</td><td>Makes the row non-editable</td><td>Grid, Matrix</td></tr><tr><td>Row Highlight</td><td>Entire row</td><td>Applies background fill to the row</td><td>Grid, Matrix</td></tr><tr><td>Row Action*</td><td>Row Action</td><td>Make the Row Action button hidden</td><td>Grid only</td></tr></tbody></table>

* \*Only applicable for Wave Embedded.

***

## Matrix Rule Behavior

#### Aggregated Values

Matrix rule actions are evaluated based on the value displayed in the matrix cell, not the values in the underlying records.

* Rules are evaluated for cells with a single displayed value.
* Rules are not evaluated for cells showing **\[Multiple]**, because the underlying records contain different values.

#### Field Combinations (When → Then)

The fields selected in the When condition determine which actions are available in Then:

<table data-search="false"><thead><tr><th width="215">Fields Selected (When)</th><th width="545">Available Actions (Then)</th></tr></thead><tbody><tr><td>X-Axis field only</td><td>Cell Format (Data), Cell Highlight (Data), Column Format, Column Highlight</td></tr><tr><td>Y-Axis field only</td><td>Cell Format (Y and Data), Cell Highlight (Y and Data), Row Read Only, Row Highlight</td></tr><tr><td>Data field only</td><td>Cell Format (Data), Cell Highlight (Data)</td></tr><tr><td>Y-Axis + Data field</td><td>Cell Format (Data), Cell Highlight (Data)</td></tr><tr><td>X-Axis + Data field</td><td>Cell Format (Data), Cell Highlight (Data)</td></tr><tr><td>Y-Axis + X-Axis field</td><td>❌ Not applicable</td></tr><tr><td>X-Axis + Y-Axis + Data field</td><td>❌ Not applicable</td></tr></tbody></table>

***

## Legends

Legends provide users with a clear explanation of why a cell or row is formatted. When a legend is configured:

* A **Legend icon** appears in the toolbar
* Clicking the icon displays a list of all configured legend messages.
* Each message is limited to **50 characters**.
* Legends are displayed visually based on the Rule’s action type — such as **bar**, **dot**, **fill**, or **read-only formatting**.

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FWAsEYeJJ07VO0xk5sUY3%2FLegend.gif?alt=media&amp;token=d7849bc6-3ff1-4cc9-881c-3edb2af4046c" alt=""><figcaption><p>Legend</p></figcaption></figure>

***

## Advanced Rule Features

### **Rule Reordering**

* Drag the number to reorder rules
* Numbers will auto-update
* New order is saved instantly

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FQTyo841x6ISMWTabibvL%2FReorder%20Rules.gif?alt=media&amp;token=0323c97b-492c-4672-ba86-369f07b56bb2" alt=""><figcaption><p>Rule Reordering</p></figcaption></figure>

### **Overlapping Rules**

* If multiple rules apply to the same field **Format** (Read Only, Hidden) takes precedence over **Highlight.**

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FgGms1zBB83sJnKiGmMNp%2FOverlapping%20Rules.gif?alt=media&amp;token=e74448ae-b736-4a17-beb1-f5464c721c04" alt=""><figcaption><p>Overlapping Rules</p></figcaption></figure>

### **Rule Cleanup**

* If a field tied to a rule is removed from the grid:
  * A confirmation dialog will appear
  * Users can choose whether to delete the rule or cancel the field removal

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FD9rAcgC4iHx85wMwyKSN%2FRule%20Cleanup.gif?alt=media&amp;token=ca1aaeb2-806a-4439-bfe7-79176eb21382" alt=""><figcaption><p>Rule Cleanup</p></figcaption></figure>

## Filter by Color

Filter by Color allows users to filter grid rows based on Rules. It is accessible from the Toolbar.

{% hint style="info" %}
Note: **Matrix Filter by Color** is supported on the **Y-axis only**; it is not available for Data or X-axis columns.
{% endhint %}

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2F1ZSQaliwKyZkniEqpMw4%2FFilter%20by%20Color%20.gif?alt=media&amp;token=218cfcb3-c052-49b8-ac3f-324b36b4411b" alt=""><figcaption></figcaption></figure>

### Filter by Color Icon

When the Rules button is visible in the toolbar, clicking the **Filter by Color** icon the list of all configured rules that have a legend label and style assigned.

* Each entry displays a style swatch and the legend label.
* Toggle one or more rules on to filter the grid to rows matching those rules.
* Multiple active toggles use **OR logic** — rows matching any active rule are shown.
* A badge on the L icon shows the number of active filters.
* **Select All** resets all toggles and restores all rows.

### Filter Logic

<table><thead><tr><th width="472">Scenario</th><th>Logic</th></tr></thead><tbody><tr><td>Multiple rules within the same entry point</td><td>OR</td></tr><tr><td>Toolbar and column header filters both active</td><td>AND</td></tr><tr><td>Rule-based and field-based filters both active</td><td>AND</td></tr></tbody></table>

Each entry point is cleared independently.

### Rule Deletion Behavior

If a rule is deleted while a filter referencing it is active:

* The rule is removed from the Filter Color surfaces
* Any active filter referencing the deleted rule is automatically cleared.
* Rows hidden solely by that rule are restored.
* All other active filters remain unaffected.

***

## Color Bar

Color Bar lets you apply Rules to an entire column, highlighting each value based on the parameters applicable to that column.

**To apply a Color Bar:**

1. Click **Rules** in the toolbar.
2. Click **Color Bar**.
3. From the **Column** drop-down, select the column you want to format (for example, Account Type).
4. Then click **Apply**.

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FZo4Hq6fhRouECw9bPFdl%2FColorBar%20v2.gif?alt=media&amp;token=4f216c04-42a1-4cf0-989b-b7dde1b1825f" alt=""><figcaption><p>Apply a Color Bar</p></figcaption></figure>

Once selected, a number appears above the rule showing how many distinct parameters were found in that column. For example, a Lead Source column with 8 unique values (Empty, Prospect, Customer - Direct, Customer Partner / Reseller, Installation Partner, Technology Partner, Other) shows **8**, and the Rule is labeled **Color Bar applied**. Each value is automatically highlighted using a system-defined default color.

**To customize colors:**

1. Click the **Edit** (pencil) icon next to the rule.
2. In the Color Bar panel, choose a color for each value, or select **No Fill** to leave it unformatted.
3. Click **Reset to default colors** to revert all values to their system-defined colors.
4. Click **OK** to save the new color or Click the **X** to close the panel without saving.
5. Click **Apply** to apply the new color.

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FH26ILkCLea12svSYdzH3%2FColorBar%20Edit.gif?alt=media&amp;token=ee9d3a4c-3f8c-463d-8b17-3a95faf97678" alt=""><figcaption><p>Edit Color Bar</p></figcaption></figure>

**To remove a Color Bar:**

1. Click the **Delete** (trash) icon next to the rule.
2. Click **Apply**.
