# Conditions

> Which records an automation acts on. Combine conditions with and, or and not, nest them in groups, and compare dates with today instead of a fixed day.

A condition decides which records the steps run for. It appears in three places, always with the same builder:

- the card <Ui>Only if</Ui>, for <Ui>A record is created</Ui>, <Ui>A record is changed</Ui> and <Ui>On a schedule</Ui>,
- the card <Ui>Condition</Ui>, for <Ui>A condition holds</Ui>, where the condition is the trigger itself,
- the step <Ui>If / else</Ui>, under <Ui>If the record</Ui>, to send different records down different paths.

It is the same builder as in the dashboard tiles and the filters of the lists, so what you learn here works there too. Without a condition the automation runs for every record (<Ui>Without a condition it runs for every record.</Ui>). Without a data source there is nothing to check, and the card says so.

## One condition

Click <Ui>Condition</Ui> and pick three things: the **field** (the fields of the data source), the **comparison** and the **value**. The comparisons depend on the kind of field. A field can offer fewer, when its source does not support a comparison on it.

| Field | Comparisons |
|---|---|
| Text | <Ui>contains</Ui>, <Ui>does not contain</Ui>, <Ui>starts with</Ui>, <Ui>ends with</Ui>, <Ui>is</Ui>, <Ui>is not</Ui>, <Ui>is one of</Ui>, <Ui>is none of</Ui>, <Ui>is empty</Ui>, <Ui>is set</Ui> |
| Number | <Ui>greater than</Ui>, <Ui>at least</Ui>, <Ui>is</Ui>, <Ui>is not</Ui>, <Ui>at most</Ui>, <Ui>less than</Ui>, <Ui>between</Ui>, <Ui>not between</Ui>, <Ui>is empty</Ui>, <Ui>is set</Ui> |
| Date | <Ui>before</Ui>, <Ui>until</Ui>, <Ui>on</Ui>, <Ui>not on</Ui>, <Ui>from</Ui>, <Ui>after</Ui>, <Ui>between</Ui>, <Ui>not between</Ui>, <Ui>in the last</Ui>, <Ui>in the next</Ui>, <Ui>in the period</Ui>, <Ui>is empty</Ui>, <Ui>is set</Ui> |
| Yes or no | <Ui>is</Ui> |
| Choice (status, severity) and links to people or other records | <Ui>is</Ui>, <Ui>is not</Ui>, <Ui>is one of</Ui>, <Ui>is none of</Ui>, <Ui>is set</Ui>, <Ui>is empty</Ui> |

Where it fits, the row's menu offers <Ui>Compare with another field</Ui>, to compare two fields of the same record with each other instead of with a fixed value.

## And, or and not

With two or more conditions a line appears above them, such as <Ui>When all of these conditions hold</Ui>. The word in the middle is a choice.

| Choice | Holds when |
|---|---|
| <Ui>all</Ui> | every condition holds ("and") |
| <Ui>at least one</Ui> | one or more hold ("or") |
| <Ui>none</Ui> | not a single one holds |
| <Ui>not all</Ui> | at least one does not hold |

Between two rows stands the word that joins them, <Ui>and</Ui> or <Ui>or</Ui>. Clicking it switches between the two.

To mix "and" with "or", put the "or" part into a **group**. <Ui>Group</Ui> adds one, with its own choice. "The risk is open, and either its impact or its likelihood is at least 4" is a group inside the conditions:

<Screenshot src={shot_any} alt="Status is Offen and a group with at least one of: Auswirkung at least 4, Eintrittswahrscheinlichkeit at least 4" caption="The outer level says all, the group says at least one. The heading of the card reads it back with brackets." />

The menu at the end of each row (<Ui>More actions for this condition</Ui>) has:

- <Ui>Reverse</Ui>: turns the condition into its opposite, "is" into "is not".
- <Ui>Make it a group</Ui> and, on a group, <Ui>Dissolve group</Ui>.
- <Ui>Duplicate</Ui>, <Ui>Move up</Ui>, <Ui>Move down</Ui> and <Ui>Move out of the group</Ui>.

Rows and groups can also be dragged by their handle. When no more fit, the builder says <Ui>No more conditions fit here.</Ui>

## Dates relative to today

A condition on a date can name a fixed day, or a number of days from today. For "every measure whose review is due within the next two weeks", pick the date field, the comparison <Ui>until</Ui>, then <Ui>days from today</Ui> instead of <Ui>fixed date</Ui>, and enter 14. The builder shows what it means, <Ui>= today + 14 days</Ui>; a negative number counts back.

<Screenshot src={shot_relative} alt="Erste Fälligkeit until today + 14 days and Status is not Überholt" caption="Due within 14 days and not obsolete. The automation stores today + 14 days, not a date." />

nexxus stores what you mean, "today plus 14 days", not the date it was on the day you saved. Every run works it out again, in the tenant's time zone. That is what makes a weekly report or a condition like "overdue" keep working week after week.

The periods work the same way: <Ui>in the last</Ui> and <Ui>in the next</Ui> so many days, weeks, months, quarters or years, and <Ui>in the period</Ui> such as <Ui>this week</Ui>, <Ui>last month</Ui> or <Ui>next quarter</Ui>.

## When the condition is checked

| Trigger | Checked |
|---|---|
| <Ui>A record is created</Ui>, <Ui>A record is changed</Ui> | when the run starts, a few seconds after the change, against the record as it is then |
| <Ui>A condition holds</Ui> | every 5 minutes, against all records of the source |
| <Ui>On a schedule</Ui> | at each point in time, against all records of the source |
| <Ui>If / else</Ui> | when the step is reached, for each record of the run |

The condition only sees what the person the automation runs as may read. Records outside that person's rights never match.

## Next steps

<CardGrid>
  <LinkCard title="Steps and placeholders" href="/automations/steps/" description="Including If / else, which uses this builder for each branch." />
  <LinkCard title="Conditions in the dashboard" href="/use/dashboard/#conditions-with-and-or-and-not" description="The same builder in tiles and list filters." />
  <LinkCard title="Filters in NQL" href="/reference/nql/#filters" description="How conditions are written in a query." />
</CardGrid>