# Synthetic variables' editor

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

<figure><img src="/files/sAJ5zuvh3QqOTtpNkOMf" 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="/files/RpDncuyeiyAgbvqVD6Cr" 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="/files/VPfJ9YK6bz4UEBS91rkL" 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="/files/hcw0oOiSQmYtfGPTaMNY" 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="/files/iEiX9vNfzaNX3zczhit1" 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: 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://dev.ubidots.com/synthetic-variables/getting-started/synthetic-variables-editor.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.
