> From https://brixsignage.com/guides/screen-group-rules/ . All Brix pages as markdown: https://brixsignage.com/llms.txt

# Screen Group Rules: Add Screens by Name or Tag

Add screens to a digital signage group by name, tag, store number, location or orientation, with simple conditions or an expression.

Core Features 5 sections Updated November 24, 2026

A screen group rule adds screens to a group by their name, tags, store number, location or orientation. You make a rule one time. New screens and screens you rename join the group by themselves when they match. In Brix, open **Screens**, open a group, and select the **Rules** tab.

You can write a rule in two ways:

-   **Simple**: pick conditions from lists. For example, "Name contains -PAINT-" and "Tag is Portrait".
-   **Expression**: type a rule as an expression. For example, `String.startsWith(screen.name, "3") && Arrays.contains(screen.tags, "Portrait")`.

Both ways make the same rule. You can open a simple rule as an expression, and an expression that fits the simple editor opens as conditions.

## How rules work

-   **Every rule adds screens.** A screen that matches any rule joins the group.
-   **Rules run from top to bottom.** When two rules match a screen, the higher rule decides. That rule gives the position, orientation and tags. Use the arrows to move a rule.
-   **Rules never take a screen out.** A screen stays when you change, turn off or delete a rule. To take a screen out, use the **Screens** tab.
-   **Case does not count.** "paint" matches "PAINT" in every condition and in every expression.
-   **The list shows overlaps.** It tells you when the rules above already add every screen a rule matches.

## Make a rule with conditions

1.  On the **Rules** tab, select **Add a rule**.
2.  Type a name for the rule, for example "300-series one-offs". The name is optional.
3.  Pick a field, a test and a value for each condition:

-   **Name**: starts with, ends with, contains, is, fits the pattern, last part is, or matches the regex.
-   **Name** also has: does not contain, is not.
-   **Number**: the number at the start of the name (305 in 305-GARDEN): is at least, is at most, is.
-   **Tag**: is, is not.
-   **Location**: is in, is not in. A location includes the locations inside it.
-   **Orientation**: portrait or landscape.

1.  To match any one of two or more values, separate them with commas: "ends with GARDEN, TOOLS".
2.  Select **all** or **any** to say how the conditions join.
3.  To leave screens out, select **Add an exception**.
4.  Under **Screens that join by this rule get**, choose a position, an orientation and tags. Only the first rule that matches a screen gives these.
5.  Look at **Matching screens** on the right. This list shows each screen that matches and each screen that joins when you save.
6.  Look at the screens that almost match. To add one to the rule, select **Include**.
7.  Select **Add rule**.

In a pattern, `*` is any text and `?` is one character. A dash is a dash: `3??-*` matches 305-GARDEN. A pattern must fit the full name.

## Write a rule as an expression

Select **Expression** in the rule window. Type the rule. Suggestions show as you type; press Ctrl+Space to show them. An error shows the character where it is and underlines it. Select **Tidy** to write the expression in one way.

### Screen attributes

| Attribute | What it holds |
| --- | --- |
| `screen.name` | The screen name |
| `screen.tags` | The screen tags (a list) |
| `screen.location` | The name of the screen location |
| `screen.locations` | The names of the screen location and each location above it (a list) |
| `screen.orientation` | `portrait` or `landscape` |

### Functions

| Function | Result |
| --- | --- |
| `String.startsWith(text, start)` | true when the text starts with `start` |
| `String.endsWith(text, end)` | true when the text ends with `end` |
| `String.stringContains(text, part)` | true when the text contains `part` |
| `String.like(text, pattern)` | true when the text fits a `*` / `?` pattern |
| `String.firstPart(text)` | the text before the first space, `-`, `_` or `.` |
| `String.lastPart(text)` | the text after the last space, `-`, `_` or `.` |
| `String.substringBefore(text, sep)`, `String.substringAfter(text, sep)` | the text before or after `sep` |
| `String.toUpperCase(text)`, `String.toLowerCase(text)`, `String.len(text)` | the text in capitals, the text in small letters, the number of characters |
| `Arrays.contains(list, value)`, `Arrays.isEmpty(list)`, `Arrays.size(list)` | true when the list has the value, true when the list is empty, the number of items |
| `Convert.toInt(text)` | the text as a whole number, or nothing when it is not a number |
| `inLocation("name or ID", …)` | true when the screen is in one of these locations, or in a location inside it |

You can also write a function as a method: `screen.name.startsWith("3")`.

### Operators

-   `&&`, `||` and `!`. `AND`, `OR` and `NOT` also work.
-   `==`, `!=`, `<`, `>`, `<=`, `>=`.
-   `condition ? a : b`.
-   `text matches "regex"`. The regular expression must fit the full text, and case does not count. Back-references (`\1`) and look-ahead are not supported. Brix runs every pattern in linear time, so no pattern can slow your screens.

An expression must read the screen. Brix refuses a rule such as `true`, because that rule would add every screen.

### Examples

```
String.stringContains(screen.name, "-PAINT-") && String.lastPart(screen.name) == "L"
Convert.toInt(String.firstPart(screen.name)) >= 300 && (String.endsWith(screen.name, "GARDEN") || String.endsWith(screen.name, "TOOLS"))
String.stringContains(screen.name, "DELI") && Arrays.contains(screen.tags, "Portrait")
screen.name matches "\d{3}-(PAINT|TOOLS)-[LCR]"
inLocation("North region") && screen.orientation == "portrait"
```

## Test a rule before you save

-   In the rule window, type a screen name and tags in **Test a name**. Each condition shows a check or a cross.
-   On the **Rules** tab, type a name in **Test a name**. Brix shows the rule that adds the screen and what the screen gets.
-   Turn a rule off with its switch to keep it without using it.

## Rules for AI assistants and the API

The Brix API and the Brix MCP tools read and write rules in both forms. A rule has `expr` for an expression, or `name`, `ending`, `tag` and `nodeId` for the simple parts, and `label` and `off`. The API refuses a bad expression with `code: invalid_rule_expression`, the rule number and the position of the error.
