# Data Structures

When having a look at some previous examples, it might not be directly obvious, but we are actually not always working just with single values, such as a number. We also had a look at examples which are actually working with a multi-value set, such as when calculating an *average*.&#x20;

So each literal has not only a [Data Type](/platform-manual/rules/rule-language/data-types.md), but also a [Data Structure](/platform-manual/rules/rule-language/data-structures.md). Here you see the full list:

## Scalar

A single value is stored in a *Scalar* data structure.&#x20;

Generally all [values](/platform-manual/rules/rule-language/syntax.md#values) are Scalars, but you typically also get Scalars when evaluating boolean or arithmetic operations.

### Examples

```java
99.5
```

Example with `$PowerConsumption` with dataset of name *PowerConsumption* of type Single Value:

```java
AVG($PowerConsumption)
```

## **Vector**

&#x20;A set of values is stored in a Vector data structure.

Generally only [variables](/platform-manual/rules/rule-language/syntax.md#variables), or operations and functions on top of [variables](/platform-manual/rules/rule-language/syntax.md#variables), may produce Vectors.

### Examples:

Example with `$PowerConsumption` with dataset of name *PowerConsumption* of type Time Series:

```java
SUBSET($PowerConsumption, now-24h)
```

## **GroupedScalar**

A list of single values, grouped by device or time.

Generally only [variables](/platform-manual/rules/rule-language/syntax.md#variables) in combination with a `GROUP_BY_DEVICE` or `GROUP_BY_TIME` function may produce a GroupedScalar.

### Examples

```java
AVG(GROUP_BY_DEVICE($PowerConsumption)) with Dataset of name PowerConsumption with type Time Series
```

## **GroupedVector**

A list of list of value sets, grouped by device or time.

Generally only [variables](/platform-manual/rules/rule-language/syntax.md#variables) in combination with a `GROUP_BY_DEVICE` or `GROUP_BY_TIME` function may produce a GroupedVector.

### Examples

```java
GROUP_BY_DEVICE($PowerConsumption) with Dataset of name PowerConsumption with type Time Series
```


---

# 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://doc.moost.io/platform-manual/rules/rule-language/data-structures.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.
