# Compare Inputs

This is pre-built Action located under the **@Generic Element,** instructs the Avo Assure to compare the inputs specified in the input Value (.xml and .json content) and save the differences in dynamic variable.

### **Syntax**

**Input Value:** `<Input Text(Original)>;<Input Text(Changed)>;<Selective/All(Optional)>`&#x20;

| Argument                                         | Description                                                                                                                |
| ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------- |
| <p>\<Input Text (Original)></p><p>(Required)</p> | Provide original input you want to compare against.                                                                        |
| <p>\<Input Text (Changed)><br>(Required)</p>     | The new or expected text value that you want to be compared.                                                               |
| <p>\<Selective/All(Optional)><br>(Optional)</p>  | <p>Optional comparison mode:<br>• All → compares the entire text exactly<br>• Selective → compares only specific parts</p> |

**Output Value:**&#x20;

| Argument                                 | Description                                               |
| ---------------------------------------- | --------------------------------------------------------- |
| <p>\<Dynamic Variable><br>(Required)</p> | This variable holds the result of the content comparison. |
| <p>\<Dynamic Variable><br>(Optional)</p> | This variable stores the status as **true** or **false**  |

{% hint style="warning" %}
**Note:** Outputs for compare files and compare Inputs are as follows:

* &#x20; JSON and text:
* \- If a line is removed from the first input
* \+ If a line is added in the second input
* ? shows the delta (difference) of the two files
* &#x20;xml: \ tags will be there with the following params:
* diff:update-attr – XML attribute is updated
* diff:delete- line deleted
* diff:insert- line inserted
* diff:delete-attr- attribute deleted
* diff:add-attr- XML attribute added
  {% endhint %}

**Example**

**Compare two input texts and highlight differences**\
\
The **Compare Inputs** action takes the value from the Input Value column (e.g., **{"name":"Alice","age":30,"email":"<alice@example.com>"};{"name":"Alice","age":28,"email":"<alice@example.com>"};all**) and compares the original input text with the changed input text. The result of the comparison is stored in the **{Comparison}** variable, and the action status is saved in the **{Status}** variable with the following possible values:

* **True** – if the inputs are compared successfully
* **False** – if the inputs are not compared&#x20;

<figure><img src="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2FDbxuyeA3wYn3OBUQaHn4%2Fimage.png?alt=media&#x26;token=cb7f92ba-108c-48e7-8d2c-984f10ba1bb5" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
**Note:** After executing the Test Steps you can see the result in the Avo Assure Client console.
{% endhint %}

<figure><img src="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2FeEteJILoHaPrEiZvt4TA%2FScreenshot%202025-05-21%20152252.png?alt=media&#x26;token=a483af06-0dd5-46d0-9f56-b9bd2d70718a" alt=""><figcaption></figcaption></figure>
