> ## Documentation Index
> Fetch the complete documentation index at: https://support.caleido.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Automate labeling with rules

> Create labeling rules that assign a counterparty or dimension item to matching transaction lines automatically, edit and re-run them, check matches and exceptions, and delete rules.

A labeling rule labels transaction lines for you. Each rule maps a source, the lines that match a filter, to a target, a counterparty or a dimension item. Caleido applies the rule to existing lines and to new lines as they come in from your accounting system. Use rules for recurring costs that should always land in the same place. To label individual lines by hand, see [Label data on a report](https://support.caleido.io/guides/dimensions/label-data.md).

## Open the rules page

Open **Labeling rules** from the sidebar. You can also click **Rules view** in the **Label** window on a report.

The tabs at the bottom switch how the rules are listed:

* **Account**: rules whose source is an account
* **Counterparty**: rules whose source is a counterparty (the default)
* **Dimension label**: rules whose source is a dimension item
* **Transaction line**: rules with any other filter, such as memo text or amount

Each row is a source. The columns to the right are the targets: **Counterparty** and one column per dimension. The **Mapped** and **Unmapped** buttons above the table show only sources that have, or don't have, a target.

## Map a source in the grid

The fastest way to add or change a rule is to edit the grid directly.

1. Click the target cell of the source you want to map, for example the **Project** column of a supplier.
2. Choose the dimension item. To map several sources at once, select their rows first and then edit one of them.
3. Click **Save**. The button shows how many changes are waiting.

You can also copy a mapping from one row and paste it to others: right-click the row and select **Copy mapping**, then **Paste mapping** on the target rows.

## Create a rule with a filter

1. Click **Actions** and select **Create rule**.
2. Under **Source**, build the filter that picks the lines. Add conditions on any transaction line field, such as account, counterparty, memo, amount or date, and combine them with AND and OR.
3. Under **Target**, choose a counterparty or a dimension item.
4. Optional: click **Add effective period** and set a **Start date** and **End date**. Without a period the rule applies from the oldest transaction indefinitely. You can add several periods.
5. Leave **Allow exceptions** on if the rule should never override a label someone set by hand.
6. Check **Conflicts**. Caleido warns you if the rule overlaps another one.
7. Click **Apply all**.

> [!NOTE]
>
> A rule can't label a dimension that is already used to label its own source. If you try, Caleido shows a **Circular dependency** message.

## Edit, re-run and review a rule

* **Edit:** select a row and click **Edit**, or right-click and select **Edit**. The **Edit rule** window shows all rules for that source. **Add rule** adds another one
* **Preview:** in the **Edit rule** window, open the rule's **Actions** menu and select **Preview rule** to see the lines it matches
* **Show matches** and **Show exceptions:** right-click a target cell to list the lines the rule labeled, or the lines a person labeled differently. You can remove exceptions so the rule labels those lines again
* **Run rules:** select one or more rules and click **Actions** > **Run rules** to apply them again to all matching lines

The **Edit rule** window also shows who created and last edited the rule, and when it last ran.

## Delete rules

1. Select the rows.
2. Click **Delete**, or press Delete on the keyboard.
3. Confirm.

Use **Delete and revert labels** instead if you also want to remove the labels the rule already applied. Ctrl+Delete (Cmd+Delete on Mac) deletes without asking.

## Find rules

* **Actions** > **Modify** > **Filter…** opens an advanced filter. **Clear filters** appears while a filter is on
* **Sort…** and **Group…** are in the same submenu. **Actions** > **Columns…** chooses which target columns are shown

## Related pages

* [Label data on a report](https://support.caleido.io/guides/dimensions/label-data.md)
* [Use the general ledger and journal](https://support.caleido.io/guides/transactions/general-ledger.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.