# Compare Variable

![](/files/-M5NbiXjokguB8PHsahW)

## **Function**

This module provides a way to compare variables and to re-direct end-users to a different area of the call-flow based on the value of a variable.\
Additional comparison conditions can be added/removed from the module by pressing the add and remove (<img src="/files/-M4u9_-hAMbYcqwmycsz" alt="" data-size="line">) buttons.

If a comparison condition is true, the call will be directed to the node to the side of that condition (<img src="/files/-M4u9_173BZvzhbMevd3" alt="" data-size="line">).\
If none of the conditions are true, the call will go through the node at the bottom of the module (<img src="/files/-M4u9_15oYs9vApEAHhJ" alt="" data-size="line">) .

Depending on the value and variable in the comparison, the correct type should be used to avoid any unexpected results. The three types of comparison that are supported in this module are:

* **String** (default)
* **Numeric**
* **Boolean**

The currently selected comparison type will also show up on the module above the comparison drop down. For more information, please refer to the [compare types](/fuse/call-flow/compare-variable.md#compare-types) section under settings.

This module is commonly used with end-user input, or when getting results from a webservice for branching into different parts of the call flow based on the result.

{% hint style="info" %}
**Note**: For a simpler increment counter, the [Counter](/fuse/call-flow/counter.md) (<img src="/files/-M4u9_-xqXFdLDRt2mUd" alt="" data-size="line">) can be used instead of the comparison as it has a built in increment logic for the counting variable.
{% endhint %}

## **Comparisons**

The following comparison operators can be selected in the drop down

* Equals to ( = )
* Greater than ( > )
* Lesser than ( < )
* Greater than or equals to ( ≥ )
* Lesser than or equals to ( ≤ )
* Not equals to ( ≠ )

It is recommended to only use the equals ( = ) and not equals to ( ≠ ) operators for *string* and *boolean* types.

## **Module Settings**

![](/files/-M5NbiYxtdk8B2HfEJfH)

### [Private](/fuse/module-settings.md#private)

|                                                                     |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| <img src="/files/-M5NbiYoLH9-yNY0kT9f" alt="" data-size="original"> | <p>This setting controls the logging function of a module.<br>Enabling the 'Private' setting instructs the module to not record, report, or retain the information input to that module for reporting or any other purposes. When enabled any information entered into a module during a call will be lost immediately when the call terminates.<br>The 'Private' setting is critical for businesses that need to maintain PCI-DSS or HIPAA compliance.<br><br>The module icon, in the upper left-hand corner, becomes grayed-out when this setting is enabled. See more details <a href="/pages/-M4zJLOnor8aJqMZ7an7#visual-indicators">here</a>.</p> |

### [**Compare Types**](/fuse/module-settings.md#compare-types)

There are 3 different types of comparisons that can be used in the module.

* String (default)
* Number
* Boolean

Most of the variables generated by input modules in the Fuse application are by default string types, therefore it is important to set the correct type when doing comparisons.

Any text entered into the module are compared as-is and the module does not evaluate any Javascript before the comparison.\
\
Comparing for *undefined* or *null* values are **not possible** with this module as all input in the module will be converted to either of the 3 formats. Those conditions will have to be checked with the [Evaluate JavaScript](/fuse/data/evaluate-js.md) (<img src="/files/-M4u9_0dW34reXbZ8q03" alt="" data-size="line">) module.

![](/files/-M5NbiXkaFveb6rqpF0c)

| Type        | Notes                                                                                                                                                                                                                                                                                                                                                                                | Example                                                             |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------- |
| **String**  | <p>The string compare type is used by default in the module.<br>Only = or ≠ operators should be used for string types.</p>                                                                                                                                                                                                                                                           | <img src="/files/-M5NbiXngrnYlFw-y4Wb" alt="" data-size="original"> |
| **Number**  | <p>When selected, Fuse will apply a javascript <em>Number()</em> function to both fields before making the comparison.<br><br>Using the incorrect compare type for numbers can have unexpected results because of how Javascript behaves with certain comparison operators and types. For example, “9” > “100” as <em>string</em> types, while 9 < 100 as <em>number</em> types.</p> | <img src="/files/-M5NbiXmy8PKj5J0B5w8" alt="" data-size="original"> |
| **Boolean** | <p><em>True</em> or <em>False</em> should be used for boolean comparisons.<br>Only = or ≠ operators should be used for boolean types.</p>                                                                                                                                                                                                                                            | <img src="/files/-M5NbiXlE9X1iIJhhbPw" alt="" data-size="original"> |


---

# 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.plumvoice.com/fuse/call-flow/compare-variable.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.
