# Data Types

In the [Values section](https://doc.moost.io/platform-manual/rules/syntax#values) featured already some data types. Each literal has a specific data type. Here you see the full list:

## Boolean

<table><thead><tr><th width="176">Literal</th><th>Description</th></tr></thead><tbody><tr><td>true</td><td>Value for true / fulfilled</td></tr><tr><td>false</td><td>Value for false / not fulfilled</td></tr></tbody></table>

### Examples

```java
true
```

```java
AVG($PowerConsumption) > 1000
```

## Number

A decimal number

### Examples

```java
42.0
```

```java
$Event::Value * 1.5
```

## Time

A time which consists of date and day time.

Besides of event times, we can also use one of following supported literals:

<table><thead><tr><th width="245">Literal</th><th>Description</th></tr></thead><tbody><tr><td>now</td><td>The current time. This produces e.g. <em>2023-09-25 23:26</em></td></tr><tr><td>lastHour</td><td>The last full hour.  E.g. <em>2023-09-25 23:00</em></td></tr><tr><td>lastZeroHour</td><td>The last zero hour (midnight). E.g. 2023-09-25 00:00</td></tr><tr><td>startOfLastMonth</td><td>The first day of the previous month. E.g. 2024-05-01 00:00</td></tr><tr><td>endOfLastMonth</td><td>The last day of the previous month. E.g. 2024-05-31 00:00</td></tr><tr><td>startOfMonthBeforeLast</td><td>The first day of the penultimate month E.g. 2024-04-01 00:00</td></tr><tr><td>endOfMonthBeforeLast</td><td>The last day of the penultimate month E.g. 2024-04-30 00:00</td></tr><tr><td>startOfCurrentMonth</td><td>The first day of the current month. E.g. 2024-06-01 00:00</td></tr><tr><td>endOfCurrentMonth</td><td>The last day of the current month. E.g. 2024-06-30 00:00</td></tr></tbody></table>

### Examples

```java
$Event::Timestamp
```

```java
now - 24h
```

## Timespan

A timespan.

A timespan literal is a combination of a number and a time unit. Following time units are supported:

<table><thead><tr><th width="180">Literal</th><th>Description</th></tr></thead><tbody><tr><td>d</td><td>Days</td></tr><tr><td>h</td><td>Hours</td></tr><tr><td>min</td><td>Minutes</td></tr><tr><td>s</td><td>Seconds</td></tr></tbody></table>

### Examples

```java
7d
```

```java
24h
```

```java
30min
```

## Text

A text element

Everything that begins and ends with a single or double quotation mark is considered a text element. This also includes elements that cannot be assigned to one of the other data types. For example, if $Event was used but no such variable was defined, it would also be considered a text element.

Remark: we recommend to use one of the quoted forms, which makes it crystal clear for the readers that this is a text.

### Examples

```java
'foo'
```

```java
"bar"
```

```java
foo
```

## Event

An event, which consists of:

<table><thead><tr><th width="179">Attributes</th><th>Description</th></tr></thead><tbody><tr><td><code>Value</code></td><td>The value of the event, which is of type <a href="#number"><em>Number</em></a></td></tr><tr><td><code>Timestamp</code></td><td>The timestamp of the event, which is of type <a href="#time"><em>Time</em></a></td></tr><tr><td><code>DeviceName</code></td><td>The name of the device which is the source of this event. It is of the of type <a href="#text"><em>Text</em></a></td></tr><tr><td><code>DeviceId</code></td><td>The ID of the device, which is the source of this event. It is of the of type <a href="#text"><em>Text</em></a></td></tr></tbody></table>

### Examples:

```java
$Event::DeviceName
```

## Building

The building related to the event, so that building related data can be accessed via *Attribute Accessor*, see:[#accessor-on-building](https://doc.moost.io/platform-manual/rules/operations/attribute-accessor#accessor-on-building "mention").

<table><thead><tr><th width="268">Attributes</th><th>Description</th></tr></thead><tbody><tr><td><code>Id</code></td><td>The value of the event, which is of type <a href="#text">Text</a></td></tr><tr><td><code>RegistrationTimestamp</code></td><td>The timestamp when the building was registered, i.e. the on-boarding timestamp on the customer side. It is of type <a href="#time"><em>Time</em></a></td></tr><tr><td><code>DeviceTypes</code></td><td>The set of device types (which relates to the "source" entries in the events). It is a Vector of type <a href="#text">Text</a>.</td></tr></tbody></table>

### Examples:

```java
Building::DeviceTypes
```
