> For the complete documentation index, see [llms.txt](https://docs.datacake.de/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.datacake.de/device/database/fields/formulas.md).

# Formulas

## What is a Formula?

Formulas can be used to perform basic mathematical operations and derive measurements based on the current values of other fields.

At the moment, the supported operations are `+`, `-`, `*` and `/`.

You can use both static expressions as well as other fields in your formula. For example, to calculate a measurement in celsius based on another field that holds the value in Fahrenheit, you would use the formula `(TEMPERATURE_F - 32) * (5/0)`, where `TEMPERATURE_F` is the field identifier of the Fahrenheit-field.

## Creating a Formula

Defining a formula is very simple. Simply select one or more fields from the "Available Placeholders" list that should provide measured values for the conversion. Use this line also to enter the operations.

![](https://2221155863-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LNA8_b8wmabHgJ0QXoJ%2F-M-LATvN6LaQUIi48ehV%2F-M-LAkTqnzbLbRfUrY7U%2FBildschirmfoto%202020-02-05%20um%2017.21.03.png?alt=media\&token=360b05c7-e325-407a-b548-1c6173397c67)

## Examples

### Combining multiple fields into a single one

You can use a formula to combine the measured values of different fields and perform calculations based on these values. This is suitable, for example, for setting up compound values or conditions, where the processing of several measured values is required.

![](https://2221155863-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LNA8_b8wmabHgJ0QXoJ%2F-M5xG-D30ImNkaT3TJKf%2F-M5xH1H0JyYll0aImDSX%2FBildschirmfoto%202020-04-27%20um%2022.15.48.png?alt=media\&token=a7d4bdeb-72f6-4fe5-af88-7578e9577af0)

### Converting Celsius to Fahrenheit

The following screenshot shows a newly created field and its configuration dialog including the formula for the conversion of a Celsius output value of another field into the unit Fahrenheit.

![](https://2221155863-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LNA8_b8wmabHgJ0QXoJ%2F-M-L8EPUMh5r1DI0-tSV%2F-M-L9BQulRhn5FWGlYh3%2FBildschirmfoto%202020-02-05%20um%2017.21.03.png?alt=media\&token=6842925b-f1ea-493e-950b-038989fadca0)

Each time a new value is being recorded to the `TEMPERATURE` field, the formula is executed and the result (temperature in Fahrenheit) is written to the `TEMPERATURE_F` field.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.datacake.de/device/database/fields/formulas.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
