# Get index count

This is a pre-built Action located under the **@Generic Element**. The functionality of this Action in Avo Assure is to retrieve the total number of items (index count) present in a list within the AUT. The execution result is stored in the dynamic variable.

## **Syntax**

**Input Value**: `<variable containing list value>`&#x20;

{% hint style="info" %}
**Note:**&#x20;

* The variable name should be enclosed within curly braces.
* To display the variable:
  * For a 1-dimensional array, the index starts from 0, and the array count will start from the 0th index. For example, if the count is 7, it will fetch a value of 6.
  * For Desktop AppType, the index starts from 1, and the array count will start from the 1st index.
    {% endhint %}

| Argument                                               | Description                                                 |
| ------------------------------------------------------ | ----------------------------------------------------------- |
| <p>\<variable containing list value><br>(Required)</p> | Provide a list which total number of items will be counted. |

**Output Value**: `<Dynamic Variable>;<Dynamic Variable>(Optional)`

| Argument                                     | Description                                                           |
| -------------------------------------------- | --------------------------------------------------------------------- |
| <p>\<Dynamic Variable><br>(Required)</p>     | This dynamic variable stores the number of items present in the list. |
| <p>\<Dynamic Variable></p><p>(Optional) </p> | This dynamic variable stores the status as **True** or **False**.     |

### **Example:** Retrieving the Total Number of Items in a List

In this example, we explain how to retrieve the total number of items present in a list.

* **Action**: Get Index Count

{% hint style="info" %}
**Note**: Before you use the **Get Index Count** action, make sure a previous step **Get All Values from List** action retrieves the list items and stores them in a dynamic variable. For example: {Values}.
{% endhint %}

* **Input Value:** {Values}
  * The argument (**{Values}**) specifies the dynamic variable that contains the list whose total number of items needs to be calculated.
  * The stores array list in this **{Values}** variable is: \['HTML, 'Python', 'Java']
* **Output Value:** {Count}
  * The fetched number of items (3) present in the list is stored in this **{Count}** dynamic variable.
  * If a second output variable is provided, then action returns the status as **True** or **False**:
    * **True**: if the index count is retrieved successfully.
    * **False**: if the action fails due to an invalid or empty list.
* **Logical Explanation**: The **Get Index Count** action takes the list variable provided in the **Input Value** column (**{Values}**) and calculates how many items exist in that list. It stores the total number of items (3) in the **{Count}** variable.

<figure><img src="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2FRSuhq6R0Aoj70ZHqDrbE%2Fimage.png?alt=media&#x26;token=b7713eba-150d-4b12-a8fd-83679fdd1a12" alt=""><figcaption></figcaption></figure>
