---
description: >-
  The Rule Sandbox provides an isolated environment where you can test data
  processing rules.
---

# Rule Sandbox

The Rule Sandbox allows you to develop and test your data processing rules directly in Connectware without affecting your live data or production systems. In the Rule Sandbox, you can input sample data that represents what you expect in your actual data flows, set up your rules, and then run the simulation to see the results. This allows you to fine-tune your rules before deploying them in a live environment.

As the transformation source, you can select JSON, endpoints, or MQTT topics.

Here is an overview of what you can do with the Rule Sandbox:

**Real-time Rule Execution**

* You can input sample data and immediately see how your rules process it. This allows you to verify that your rules are working as intended and to quickly iterate on your rule designs.

**Step-by-step Visualization**

* The Rule Sandbox shows you how data moves through each step of your rule pipeline. You can see the input and output of each individual rule, helping you understand exactly how your data is being transformed at each stage.

**Error Detection**

* If there are any issues with your rules, such as syntax errors or logical problems, the Rule Sandbox will highlight these, making it easier to debug your rules.

**Performance Insights**

* While it's not a full-fledged performance testing tool, the Rule Sandbox can give you a general idea of how your rules perform, which can be useful for optimizing complex rule sets.

**Rule Experimentation**

* You can modify rules, change their order, or try out new rule combinations to see how they affect your data processing. This makes it a valuable tool for developing and refining your data processing strategies.

**Learning Tool**

* The Rule Sandbox can serve as an interactive learning environment where you can experiment with different rule types and see their effects in real-time.

## Rule Sandbox View

This is an overview of the functions of the **Rule Sandbox** view.

* To open the **Rule Sandbox** view, select **Services** > **Rule Sandbox**.

<figure><img src="https://2317229820-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLPAf7nVSLAm6jvBxu1bg%2Fuploads%2Fgit-blob-882e725deaf3547cab151832bd788bda1b9bf728%2Frule-sandbox-view.png?alt=media" alt=""><figcaption></figcaption></figure>

**Select the transformation source**

* Select the source of your transformation. The following transformation sources are available:
  * **JSON**
  * **Endpoint**
  * **MQTT Topic**

**Select an Endpoint**

* Select the endpoints for which you want to apply data processing rules. The list displays all endpoints that are currently connected to Connectware. You can select one or multiple endpoints. If you select multiple endpoints, the **Last transformation input** field always displays the data of the endpoint that was most recently updated.

<figure><img src="https://2317229820-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLPAf7nVSLAm6jvBxu1bg%2Fuploads%2Fgit-blob-8dda2e11210b96f1399dcab0ce8298ccd64afca2%2Frule-sandbox-select-an-endpoint.png?alt=media" alt=""><figcaption></figcaption></figure>

**Input the MQTT Topic**

* Select the MQTT topic for which you want to apply data processing rules. The **Last transformation input** field displays the data of the MQTT topic that you have selected.

**Custom transformation input**

* If you have selected **JSON** as the transformation source, you can enter custom transformation input for testing your data processing rules.

**Last transformation input**

* If you have selected **Endpoint** or **MQTT Topic** as the trasnformation source, this field displays the last detected transformation input for the selected endpoint or MQTT topic. You cannot enter custom transformation here.

**Transformation rule expression**

* Enter the transformation rule expression that you want to test.

**Transformation result**

* Displays the result of your transformation rule.

## Testing and Refining Data Processing Rules

You can test and refine rules using real data from endpoints and MQTT topics, or create custom JSON input for custom scenarios.

### Using Endpoint or MQTT Topic Data

1. In the **Rule Engine** view, select **Endpoint** or **MQTT Topics** from the **Select the transformation source** menu.
2. Do one of the following:
   * For **Endpoint**: Select an endpoint from the **Select an Endpoint** list.
   * For **MQTT Topics**: Specify the MQTT topic location in the **Input the MQTT Topic** field.
3. Specify your data processing rule in the **Transformation rule expression** field. For a list of all data processing rules, see [Data Processing Rules](data-processing-rules).

The result of your data processing rule is displayed in the **Transformation result** field.

### Using Custom JSON Input

1. In the **Rule Engine** view, select **JSON** from the **Select the transformation source** menu.
2. Enter your custom JSON data in the **Custom transformation input** field.
3. Specify your data processing rule in the **Transformation rule expression** field. For a list of all data processing rules, see [Data Processing Rules](data-processing-rules).

The result of your data processing rule is displayed in the **Transformation result** field.
