# Attribute Accessor

### Description

Access sub-data of the argument.

### Accessor on Scalar\<Event>

```java
Scalar<Event>::Value             : Scalar<Number>
Scalar<Event>::DeviceId          : Scalar<Text>
Scalar<Event>::DeviceName        : Scalar<Text>
Scalar<Event>::Timestamp         : Scalar<Time>
Scalar<Event>::ForecastTimestamp : Scalar<Time>
```

#### Returns

Returns the event value, device id, device name, timestamp or forecast timestamp.

Remark: if there is no forecast timestamp, "0" is returned

#### Examples

Get the value of the event stored in the PowerConsumption Variable.

```java
$PowerConsumption::Value
$PowerConsumption::Timestamp
```

***

### Accessor on Vector\<any>

<pre class="language-java"><code class="lang-java"><strong>Vector&#x3C;any>::First : Scalar&#x3C;any>
</strong>Vector&#x3C;any>::Last  : Scalar&#x3C;any>
</code></pre>

#### Returns

&#x20;Returns the first or last element of the Vector as Scalar\<any>

#### Examples

Get the first Event from the $PowerGeneration vector.

```java
$PowerConsumption::First
```

***

### Accessor on Vector\<Event>

<pre class="language-java"><code class="lang-java"><strong>Vector&#x3C;Event>::Value             : Vector&#x3C;Number>
</strong>Vector&#x3C;Event>::DeviceId          : Vector&#x3C;Text>
Vector&#x3C;Event>::DeviceName        : Vector&#x3C;Text>
Vector&#x3C;Event>::Timestamp         : Vector&#x3C;Time>
Vector&#x3C;Event>::ForecastTimestamp : Vector&#x3C;Time>
</code></pre>

#### Returns

Returns the set of event values, device ids, device names, timestamps or forecast timestamps.

Remark: if there is no forecast timestamp, "0" is returned

#### Examples

Get the values of all events in the vector $PowerConsumption as new Vector\<Number>

```java
$PowerConsumption::Value
```

***

### Accessor on GroupedScalar\<any, Event>

<pre class="language-java"><code class="lang-java"><strong>GroupedScalar&#x3C;any, Event>::Value             : Vector&#x3C;Number>
</strong>GroupedScalar&#x3C;any, Event>::DeviceId          : Vector&#x3C;Text>
GroupedScalar&#x3C;any, Event>::DeviceName        : Vector&#x3C;Text>
GroupedScalar&#x3C;any, Event>::Timestamp         : Vector&#x3C;Time>
GroupedScalar&#x3C;any, Event>::ForecastTimestamp : Vector&#x3C;Time>
</code></pre>

#### Returns

Returns the set of event values, device ids, device names, timestamps or forecast timestamps, grouped by device or time spans.

#### Examples

Get the values of all events in the group $PowerConsumption as new Vector\<Number>

```java
GROUP_BY_DEVICE($PowerConsumption)::Value
```

***

### Accessor on GroupedScalar\<Device, any>

<pre class="language-java"><code class="lang-java">GroupedScalar&#x3C;Device, any>::GroupKeyDeviceId   : Vector&#x3C;Text>
<strong>GroupedScalar&#x3C;Device, any>::GroupKeyDeviceName : Vector&#x3C;Text>
</strong></code></pre>

#### Returns

Returns the device id or name of the device which is part of the GroupedScalar key.

#### Examples

Get all device names from all the devices in the $PowerConsumption group.

```java
GROUP_BY_DEVICE($PowerConsumption)::GroupKeyDeviceName
```

***

### Accessor on GroupedScalar\<any, any>

<pre class="language-java"><code class="lang-java"><strong>GroupedScalar&#x3C;any, any>::GroupKeyValue : Vector&#x3C;any>
</strong></code></pre>

#### Returns

Returns the value of the group as new Vector\<any>.

#### Examples

Get all Values from the $PowerConsumption group.

```java
GROUP_BY_DEVICE($PowerConsumption)::GroupValue
```

***

### Accessor on GroupedVector\<any, any>

<pre class="language-java"><code class="lang-java"><strong>GroupedVector&#x3C;any, any>::First : GroupedScalar&#x3C;any, any>
</strong>GroupedVector&#x3C;any, any>::Last  : GroupedScalar&#x3C;any, any>
</code></pre>

#### Returns

Returns a GroupedScalar, which holds the first or last value of each group.

#### Examples

Get all Values from the $PowerConsumption group.

```java
GROUP_BY_DEVICE($PowerConsumption)::First
```

***

### Accessor on GroupedVector\<any, Event>

<pre class="language-java"><code class="lang-java"><strong>GroupedVector&#x3C;any, Event>::Value             : GroupedVector&#x3C;Number>
</strong>GroupedVector&#x3C;any, Event>::DeviceId          : GroupedVector&#x3C;Text>
GroupedVector&#x3C;any, Event>::DeviceName        : GroupedVector&#x3C;Text>
GroupedVector&#x3C;any, Event>::Timestamp         : GroupedVector&#x3C;Time>
GroupedVector&#x3C;any, Event>::ForecastTimestamp : GroupedVector&#x3C;Time>
</code></pre>

#### Returns

Returns the values, device ids, device names, timestamps or forecast timestamps of all events in the group and return as new GroupedVector\<Number>.

#### Examples

Get the values of all events in the group $PowerConsumption as new Vector\<Number>

```java
GROUP_BY_DEVICE($PowerConsumption)::Value
```

***

### Accessor on GroupedVector\<Device, any>

```java
GroupedVector<Device, any>::GroupKeyDeviceId   : Vector<Text>
GroupedVector<Device, any>::GroupKeyDeviceName : Vector<Text>
```

#### Returns

Returns the device ids or device names of all devices which are the groups key, and return as new Vector\<Text>.

#### Examples

Get all device names from all the devices in the $PowerConsumption group.

```java
GROUP_BY_DEVICE($PowerConsumption)::GroupKeyDeviceName
```

***

### Accessor on Scalar\<Building>

```java
Building::Id
Building::RegistrationTimestamp
Building::ActivationTimestamp
Building::DaysSinceActivation
Building::DeviceTypes
Building::EconomicalMotivationScore
Building::EcologicalMotivationScore
Building::SelfSufficiencyMotivationScore
Building::MultiPersonScore
Building::CommercialBuildingScore
Building::IsSelfSufficiencyMotivated
Building::IsEcologicalMotivated
Building::IsSelfSufficiencyMotivated
Building::IsMultiPerson
Building::IsSinglePerson
Building::IsResidential
Building::IsCommercial
Building::IsInSameCountry
Building::IsInSameConsumptionCategory
Building::All
```

#### Returns

Selects the event related building, and returns the specified building data, such as the building id, the registration date when the building was registered, the activation date when the building was activated on MOOST side, or the types of all devices.

See [Data Types](/platform-manual/rules/rule-language/data-types.md#building)

#### Examples

Get all device types from the event related device.

```java
Building::DeviceTypes
```

### Properties Accessor on Scalar\<Building>

A special case is the Properties Accessor on the ScalayBuilding>. It allows to select the value that is defined in a customer property on a building and use it in the rule language.

```java
Building::Properties[energyThreshold]
```

#### Returns

Returns the value that is defined in the according properties entry on the building. When used in a rule condition the rule can only be trigger for buildings that have the according property set.

#### Examples

Use the value of the Property "energyThreshold" defined on the buildings to compare it against a dataset of type EnergyConsumption.

```java
$EnergyConsumption > Building::Properties[energyThreshold]
```

### Accessor on Scalar\<DeliveredNotification>

```java
DeliveredNotification::DeliveryTimestamp
DeliveredNotification::InteractionTimestamp
DeliveredNotification::InteractionType = ( 'OPENAPP' | 'OPENWEB' | 'DISMISS' | 'STOPDELIVERY' )
```

#### Returns

When used in Goal-achieved condition, selects the delivered notification, and returns

* the time when the notification was delivered
* the time when the interaction happened
* the type of the interaction (e.g. `OPENAPP`)

See [Literals](/platform-manual/rules/rule-language/literals.md#deliverednotification)

#### Examples

Get all device types from the event related device.

```java
DeliveredNotification::InteractionType = 'OPENAPP'
DeliveredNotification::InteractionTimestamp - DeliveredNotification::DeliveryTimestamp < 8h
```


---

# 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/operations/attribute-accessor.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.
