# Clean Items Before a Certain Date

### Overview

This procedure removes all **the keys** from a department box *(a storage unit within an agent)* before a certain date. The date can be specified as a relative or absolute value.

### Syntax

Below is a line-by-line overview of the automation syntax. Expand each line to learn more.

<details>

<summary><code>x is a department box</code></summary>

#### What does it do?

Specifies a department box.

#### Where does it go?

This phrase should be written on a **new line**.

#### Is it required?

✅ Yes — This phrase is **required**.

#### Does it require data?

✅ Yes — Replace **x** with the department box's name.

#### Example

```
HR is a department box
```

</details>

<details>

<summary><code>the department box's engine is x</code></summary>

#### What does it do?

Specifies the engine used for the department box. Options include: **Amazon S3** for large or unstructured data, **Amazon DynamoDB** for fast key-value lookups, and **Amazon OpenSearch** for advanced search and filtering capabilities.

#### Where does it go?

This phrase should be written on a **new line**.

#### Is it required?

❌ No — This phrase is **optional**.

#### Does it require data?

✅ Yes — Replace **x** with one of the following values: `s3`, `dynamodb`, `opensearch`. The default is `s3`.

#### Example

```
the department box's engine is "dynamodb"
```

</details>

<details>

<summary><code>clean x before "date"</code></summary>

#### What does it do?

Removes all keys from the department box before a certain date.

#### Where does it go?

This phrase should be written on a **new line**.

#### Is it required?

✅ Yes — This phrase is **required**.

#### Does it require data?

✅ Yes — Replace **x** with the department box's name. Replace **date** with a text value or reference to a date or time, which can be relative or absolute.

#### Example

```
clean HR before '3 hours'
```

</details>

### Examples

#### 1. Clean Before Relative Date

A relative date is based on the current time. The following removes all items from the department box that are older than 3 hours:

```
HR is a department box
the department box's engine is "s3"
clean HR before '3 hours'
```

#### 2. Clean Before Absolute Date

An absolute date is a fixed point in time. The following removes all items from the department box that were added before October 23, 2020:

```
HR is a department box
the department box's engine is "s3"
clean HR before '23rd Oct 2020'
```
