# Repeatable

## Introduction

The Repeatable Action in Autom Mate allows users to iterate through data sets, such as numeric arrays or data tables, performing operations on each element or row sequentially.

The purpose of the Repeatable Action is to streamline processes that require performing actions on each item or row within a dataset, making it ideal for tasks like processing Excel rows, data tables, emails, and more.

## What is Repeatable?

The Repeatable Action provides two types of looping:

1. **Variable: For each data in variable**:
   * Used to iterate through each data element in a variable, processing them one by one.
   * Suitable for iterating over arrays, lists, or similar data structures.
2. **Mail: For each mail in variable**:
   * Designed for iterating through each email in an array variable, typically used after the Get Mail Action.
   * Ideal for processing email data, extracting information, and performing actions on each email.

## How To Use Action

### Variable: For Each Data in Variable

**Description:** The **Repeat Action** for data elements allows users to perform actions on each item in a variable, processing them sequentially.

**Usage:**

1. **Data Of The List**:
   * <mark style="color:green;">Select the variable containing the data elements to iterate through.</mark>
2. **Choose Variable**:
   * <mark style="color:green;">Assign each data element to this variable for processing.</mark>
   * <mark style="color:green;">Click the "+" button to add a new variable if needed.</mark>
3. **Assign an Index**:
   * <mark style="color:green;">Select or create a new number variable to assign an index to each iteration.</mark>
   * <mark style="color:green;">The index starts from 1, representing the order of the data element.</mark>
4. **Execution**:
   * <mark style="color:green;">Drag and drop other actions into the Repeat Action to execute for each data element.</mark>

### Mail: For Each Mail in Variable

**Description:** The **Repeat Action** for emails allows users to iterate through each email in an array variable, processing them one by one.

**Usage:**

1. **Data Of The List**:
   * <mark style="color:green;">Select the array variable containing the emails to iterate through.</mark>
2. **Choose Variable**:
   * <mark style="color:green;">Assign each email to this variable for processing.</mark>
   * <mark style="color:green;">Click the "+" button to add a new variable if needed.</mark>
3. **Execution**:
   * <mark style="color:green;">Drag and drop other actions into the Repeat Action to execute for each email.</mark>

**JSON Format of Each Mail:**

<mark style="color:orange;">**Each mail is stored in the defined variable in the following JSON format:**</mark>

```json
jsonCopy code[{
 Id: ,
 Folder: "",
 Subject: "",
 Body: "",
 From: [""],
 Cc: [""],
 To: [""],
 Date: "",
 Attachments: []bytes
}]
```

{% embed url="<https://drive.google.com/file/d/1VDLXcx0lEAYKrNtXNIAhhDUInPt0cJlx/view?usp=sharing>" %}

***

## Additional Tips

### [**Use Cases**](https://docs.autommate.com/userguide/use-cases)

### [FAQ](https://docs.autommate.com/userguide/faq)
