# Set Value

## Set Value

This guide shows you how you can use the set value feature.

### Overview

The action "Set Value" is a very powerful feature in the rule engine. You can set a value of a specific field regarding a measurement of another one. In the example below you can see how to use this for alarming.

We have a short video reviewing the feature:

{% embed url="<https://youtu.be/BvfQB21RLic?si=emCqC2vNop48LZ0e>" %}

#### General

* **Description** is meant to be used for documenting and better understanding of you own rules.
* At **Set value on the triggering device** you can select a field where you want to set a value to. If you have selected a field, you can set a value afterwards.
* If you want to **set a value on a specific device** you can define which value should be applied to which field of a single device. This can be useful if you have an overall alarming/monitoring device for several devices combined.

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

#### Advanced Settings

* **Execute action when conditions are becoming fulfilled**: If enabled, the action is executed when conditions are becoming fulfilled.
* **Execute action when conditions are fulfilled consecutively**: If enabled, the action is executed a second, third, etc., time when conditions are fulfilled consecutively.
* **Timeout between multiple executions when conditions are fulfilled**: Set the minimum amount of time in seconds that must pass before the action is executed again.
* **Execute action when conditions are no longer fulfilled**: If enabled, the action is executed when conditions are no longer fulfilled. This setting can be used to revert actions, e.g., to send an all-clear notification.

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

#### Time restrictions

See [Time Restrictions](/portal/rule-engine/new-rule-engine/time-restrictions.md) for detailed information.

### Example

#### Video Guide

Video will be attached shortly.

#### Step by step

If you have no rule created yet, create a new rule by navigating to **Rule Engine -> Add Rule**.<br>

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

In this example we will react to a new device measurement so select the template for **New Measurement Recorded**.

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

Choose a **name** for your new rule.

Set a preferred **filter for the devices** so that you can apply this rule to a single device or specific group of devices.<br>

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

The "Selected Triggers" are set for "New Measurement" by default in this template. You only need to define which fields you want to observe. So please choose a field for **"Trigger Only On Specific Measurements"**.\
In the next step you define the conditions when to set a value. Please **define a condition for a field** you chose earlier.

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

Last but not least, you can define an Action to be executed when the condition become true. Please click "Add Action" and select "Set Value". Then click on next.

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

Select the field you want a value to be set, define the value and hit "Update Action". Now you are ready to go!

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

Summarized in the shown example we observe the field "Temperature". When a new measurement is recorded, there is a check if the new measured Temperature is below or equal to 0°. If this is true, we set another field "ALARM\_TEMPERATURE" to true.


---

# 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.datacake.de/portal/rule-engine/new-rule-engine/actions/set-value.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.
