# Evaluate

This is a pre-built Action located under the **@Generic Element**. The functionality of this Action in Avo Assure is to execute a mathematical operation based on the provided value. The execution result is stored in the dynamic variable.

## **Syntax**

**Input Value**: `<operand1> <operator> <operand2>`

{% hint style="info" %}
**Note**: If your expression is long or complicated, provide the values inside parentheses () so the system can read it correctly. For example: (74-836)/(738+29).
{% endhint %}

| Argument                         | Description                                                                                                                                                                                                     |
| -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>\<operand1><br>(Required)</p> | Provide the first operand (value or variable) to use in the calculation.                                                                                                                                        |
| <p>\<operator><br>(Required)</p> | <p>Provide the operator for the calculation.<br>Supported operators are: </p><ul><li>+ (Addition)</li><li>- (Subtraction)</li><li>\* (Multiplication)</li><li>/ (Division)</li><li>^ (Exponentiation)</li></ul> |
| <p>\<operand2><br>(Required)</p> | Provide the second operand (value or variable) to use in the calculation.                                                                                                                                       |

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

| Argument                                   | Description                                                       |
| ------------------------------------------ | ----------------------------------------------------------------- |
| <p>\<Dynamic Variable><br>(Required)</p>   | This dynamic variable stores the evaluated mathematical result.   |
| <p>\<Dynamic Variable> <br>(Optional) </p> | This dynamic variable stores the status as **True** or **False**. |

### **Example 1: Performing Addition Using Two Numeric Values**

In this example, we explain how to perform an arithmetic operation using two numbers.

* **Action**: Evaluate
* **Input Value**: 235+399
  * The first argument (**235**) specifies the first number.
  * The second argument (**+**) specifies the addition operator.
  * The third argument (**399**) specifies the number added to it.
* **Output Value**: {Value}
  * The calculated value (634) is stored in this **{Value}** dynamic variable.
  * If a second output variable is provided, the action returns the status as **True** or **False**:
    * **True**: If the operation executes successfully.
    * **False**: If the operation fails due to invalid input or unsupported format.

**Logical Explanation**: The **Evaluate** action fetches the value from the **Input Value** column (**235+399**). It adds both values and stores the result (634) in the **{Value}** variable.

<figure><img src="/files/1AST6445LZidHy64VJUS" alt=""><figcaption></figcaption></figure>

### **Example 2: Adding Two Variables Containing Numeric Values**

In this example, we explain how to perform an arithmetic operation using two variables.

* **Action**: Evaluate
* **Input Value**: {Price1}+{Price2}
  * The first argument (**{Price1}**) specifies the value (784) stored in the variable.
  * The second argument (**+**) specifies the addition operator between the values which is stored in the variables.
  * The third argument (**{Price2}**) specifies the value (988) stored in the variable.

{% hint style="info" %}
**Note:** Before performing this operation, two dynamic variables must be created to store values for **{Price1}** and **{Price2}**. After creating them, the **Evaluate** action is used to add their values.
{% endhint %}

* **Output Value**: {TotalPrice}
  * The calculated value (1772) is stored in this **{TotalPrice}** dynamic variable.
  * If a second output variable is provided, the action returns the status as **True** or **False**:
    * **True**: If the arithmetic operation executes successfully.
    * **False**: If the operation fails due to missing or non-numeric variable values.
* **Logical Explanation**: The **Evaluate** action fetches the values from the **Input Value** column (**{Price1}+{Price2}**). It adds their numeric values (784+988) and stores the result (1772) in the **{TotalPrice}** variable.

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

### **Example 3: Performing a Complex Arithmetic Expression Using Parentheses**

In this example, we explain how to perform an arithmetic operation using a longer expression that requires parentheses for correct evaluation.

* **Action**: Evaluate
* **Input Value**: (10+5)\*(94+26)
  * The first argument (**(10+5)**) groups the addition so the system processes it before multiplication.
  * The second argument (**\***) specifies the multiplication operator that combines the results of both grouped expressions.
  * The third argument (**(94+26)**) groups another addition expression that will be multiplied with the first result.
* **Output Value**: {Value}
  * The final calculated value (1800) is stored in this **{Value}** dynamic variable.
  * If a second output variable is provided, the action returns the status as **True** or **False**:
    * **True**: If the arithmetic operation executes successfully.
    * **False**: If the operation fails due to an invalid expression or undefined variable.
* **Logical Explanation**: The **Evaluate** action fetches the value from the **Input Value** column (**(10+5)\*(94+26)**). Because both expressions are enclosed in parentheses, the system first adds 10 + 5 = 15.\
  It then adds 94 + 26 = 120. The system multiplies 15 × 120, producing the result 1800, which is stored in the **{Value}** variable.

<figure><img src="/files/52ZDLxhNmj4UVnMmihlf" alt=""><figcaption></figcaption></figure>

#### **Knowledge** Bites:

Below are some examples of different mathematical operators:

| Operators           | Input Value                                                                                                            | Result |
| ------------------- | ---------------------------------------------------------------------------------------------------------------------- | ------ |
| ^ (Exponentiation)  | 8^3                                                                                                                    | 512    |
| / (Division)        | 908/23                                                                                                                 | 39.48  |
| - (Subtraction)     | <p>{Value1};3 <br>8-{Value1}<br><strong>Note</strong>: {Value1} is a created dynamic variable, and its value is 3.</p> | 5      |
| + (Addition)        | 34.89+773.222                                                                                                          | 808.11 |
| \* (Multiplication) | 89\*34                                                                                                                 | 3026   |


---

# 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/mathematical-operations/evaluate-1.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.
