# Compare Values

This is a pre-built Action located under the **@Generic Element**. The functionality of this Action in Avo Assure is to compare two strings without considering their case sensitivity, treating both strings as the same case. The comparison result is stored in a dynamic variable.

## **Syntax**

**Input Value**: `<value1>;<value2>;<lowercase(True/true)>(Optional)`&#x20;

| Argument                                     | Description                                                                                                                                                                                                                                                                             |
| -------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>\<value1><br>(Required)</p>               | <p>Provide the first value that needs to be compared.</p><p>The input value can accept special characters, numbers, and string.</p>                                                                                                                                                     |
| <p>\<value2><br>(Required)</p>               | Provide the second value that needs to be compared with the first value.                                                                                                                                                                                                                |
| <p>\<lowercase(True/true)><br>(Optional)</p> | <p>Provide this (True/true) argument to convert both values to lowercase before comparison. This helps ensure the comparison is case-insensitive.</p><p></p><p><strong>Note:</strong> Use this only if you want to ignore case differences between uppercase and lowercase letters.</p> |

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

| Argument                                                    | Description                                                       |
| ----------------------------------------------------------- | ----------------------------------------------------------------- |
| \<Dynamic Variable>(Optional);\<Dynamic Variable>(Optional) | Both dynamic variables store the status as **True** or **False**. |

### **Example 1: Comparing Two Values**

In this example, we explain how to compare two values.

* **Action**: Compare Values
* **Input Value**: 123SAP23;123SAP23
  * The first argument **(123SAP23)** specifies the first value.
  * The second argument **(123SAP23)** specifies the second value to compare.
* **Output Value**: {Status}
  * The result of the comparison is stored in this **{Status}** dynamic variable with the following possible values:
    * **True**: If both values are identical.
    * **False:** If both values are different.

{% hint style="info" %}
**Note:** If the output variable is not defined, the comparison result will be displayed only in the execution logs and not stored in any variable.
{% endhint %}

* **Logical Explanation**: The **Compare Value** action fetches two values from the **Input Value** column **(123SAP23;123SAP23)** and compares them. Since both values are identical, the result of the comparison is True, which is stored in the **{Status}** variable.

<figure><img src="/files/d12ZoGZ8VLzq0yYTTmvy" alt=""><figcaption></figcaption></figure>

### **Example 2:** Comparing Two Values with Case-Insensitivity

In this example, we explain how to compare two values.

* **Action**: Compare Values
* **Input Value**: Apple;apple;True
  * The first argument **(Apple)** specifies the first value.
  * The second argument **(apple)** specifies the second value to compare.
  * The third argument **(True)** is an optional flag that makes the comparison case-insensitive.
* **Output Value**: {Status}
  * The result of the comparison is stored in this **{Status}** dynamic variable with the following possible values:
    * **True**: If both values are identical, or match after ignoring case when the case-insensitive flag (True/true) is used.
    * **False**: If both values are different even after applying the case-insensitive comparison.

{% hint style="info" %}
**Note**: If the output variable is not defined, the comparison result will be displayed only in the execution logs and not stored in any variable.
{% endhint %}

* **Logical Explanation**: The **Compare Value** action takes two values from the **Input Value** column **(Apple;apple;True)** and compares them. Since the optional flag (true/True) enables case-insensitive comparison, the result of the comparison is True, which is stored in the **{Status}** variable.

<figure><img src="/files/4yGgOCmo9zeoJy4U6Vim" alt=""><figcaption></figcaption></figure>

#### **knowledge Bites:** Below are some examples of different string scenarios

<table><thead><tr><th>String </th><th width="327.4000244140625">Input Value</th><th>Result </th></tr></thead><tbody><tr><td>Numeric Strings </td><td><strong>123;153</strong></td><td>False</td></tr><tr><td>Special Character </td><td><strong>abc@domain.com;abc@domain.com</strong></td><td>True</td></tr><tr><td>Alphanumeric strings </td><td><strong>ID8765;ID8565</strong></td><td>False</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.avoautomation.com/avo-assure/actions/generic/string-operations/compare-values.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
