> For the complete documentation index, see [llms.txt](https://dev.ubidots.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dev.ubidots.com/synthetic-variables/getting-started/synthetic-variables-editor.md).

# Synthetic variables' editor

The Synthetic Variables editor lets you write and configure the expression to compute.

<figure><img src="https://884329393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhzNRg0B4ECiNXc093G%2Fuploads%2F8dTrLXDg5qSW2AbWUAoB%2Fimage.png?alt=media&amp;token=8fd5c3bc-880e-4f58-af21-291af9153b47" alt=""><figcaption></figcaption></figure>

In the bottom-right corner, a message shows whether the expression is valid and can be computed, or whether it has a syntax error that you need to fix.

### **Timezone**

The editor lets you select a timezone to reference a variable's timestamps for a specific location. This is useful when you calculate a variable for a client, user, or process in a different timezone.

<figure><img src="https://884329393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhzNRg0B4ECiNXc093G%2Fuploads%2F5LsHfLtsDqDWD9vlnZrA%2Fimage.png?alt=media&amp;token=f3394f3b-8fdc-4708-89b4-1ddf09add124" alt="" width="563"><figcaption></figcaption></figure>

### **Context**

Synthetic Variables support context data. You can use the raw variable's context in the synthetic expression, as long as the context value is numeric. To access it in the editor, use the dot `.` operator on the variable, then add `context` and the context key:

```
{YOUR_VARIABLE}.context.context.key
```

<figure><img src="https://884329393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhzNRg0B4ECiNXc093G%2Fuploads%2FNjiEohtyNLuSY8W4PCdp%2Fimage.png?alt=media&amp;token=e1b501df-5cda-43e7-932a-ffa9b1d640aa" alt=""><figcaption></figcaption></figure>

### **Timestamp**

Like context data, you can access timestamps in synthetic variables with the dot `.` operator.

```
{YOUR_VARIABLE}.timestamp
```

<figure><img src="https://884329393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhzNRg0B4ECiNXc093G%2Fuploads%2FBzJSQyZQs1j1z849BNfE%2Fimage.png?alt=media&amp;token=cb55a990-6236-421f-b306-7c0642e5aff7" alt=""><figcaption></figcaption></figure>

### **Device properties**

You can use device properties in a synthetic variable expression, as long as the property is a floating-point number. To access the device object from the editor, use one of the following formats:

#### Using a device's ID:

```
{{device:<device_id>}}
```

#### Using a device's label:

<pre><code><strong>{{device:&#x3C;device_label>}}
</strong></code></pre>

Then use the dot operator `.` to access the device's properties:

```
{{device:<device>}}.properties
```

Replace `<device>` with the device `id` or `label`.

Then access any device property with its key:

```
{{device:<id>}}.properties.<key>
```

Here, `<key>` is the property key.

For example, to retrieve the `uptime` property from a device whose ID is `65fb47fad809281764f8a350`, use:

```
{{device:65fb47fad809281764f8a350}}.properties.uptime
```

To use device properties in a synthetic variable, include them in a mathematical expression with another variable. That expression determines how new values are calculated.

<figure><img src="https://884329393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhzNRg0B4ECiNXc093G%2Fuploads%2FyulMAczAMRDYzctNmjln%2Fimage.png?alt=media&amp;token=fa205576-2dd2-41cc-ae46-5ede05fb7753" alt=""><figcaption></figcaption></figure>

### Using device properties from device types synthetic variables editor

You can also create a synthetic variable across device types from the Synthetic Variables editor in the Device Types module with this syntax:

<pre><code><strong>{{device:self}}.properties.&#x3C;key>
</strong></code></pre>

Replace `<key>` with the property key you want to use. The `self` keyword is a placeholder that resolves to the actual device ID for each device in the device type.


---

# 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://dev.ubidots.com/synthetic-variables/getting-started/synthetic-variables-editor.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.
