

# Define data properties


*Asset properties* are the structures within each asset that contain asset data. Asset properties can be any of the following types:
+ **Attributes** – An asset's generally static properties, such as device manufacturer or geographic region. For more information, see [Define static data (attributes)](attributes.md).
+ **Measurements** – An asset's raw device's sensor data streams, such as timestamped rotation speed values or timestamped temperature values in Celsius. A measurement is defined by a data stream alias. For more information, see [Define data streams from equipment (measurements)](measurements.md).
+ **Transforms** – An asset's transformed time-series values, such as timestamped temperature values in Fahrenheit. A transform is defined by an expression and the variables to consume with that expression. For more information, see [Transform data (transforms)](transforms.md).
+ **Metrics** – An asset's data aggregated over a specified time interval, such as the hourly average temperature. A metric is defined by a time interval, an expression, and the variables to consume with that expression. Metric expressions can input associated assets' metric properties, so that you can calculate metrics that represent your operation or a subset of your operation. For more information, see [Aggregate data from properties and other assets (metrics)](metrics.md).

For more information, see [Create asset models in AWS IoT SiteWise](create-asset-models.md).

For an example of how to use measurements, transforms, and metrics to calculate Overall Equipment Effectiveness (OEE), see [Calculate OEE in AWS IoT SiteWise](calculate-oee.md).

**Topics**
+ [

# Define static data (attributes)
](attributes.md)
+ [

# Define data streams from equipment (measurements)
](measurements.md)
+ [

# Transform data (transforms)
](transforms.md)
+ [

# Aggregate data from properties and other assets (metrics)
](metrics.md)
+ [

# Use formula expressions
](formula-expressions.md)

# Define static data (attributes)
Define static data

*Asset attributes* represent information that is generally static, such as device manufacturer or geographic location. Each asset that you create from an asset model contains the attributes of that model.

**Topics**
+ [

## Define attributes (console)
](#define-attributes-console)
+ [

## Define attributes (AWS CLI)
](#define-attributes-cli)

## Define attributes (console)


When you define an attribute for an asset model in the AWS IoT SiteWise console, you specify the following parameters:
+ <a name="asset-property-name-console"></a>**Name** – The property's name.
+ **Default value** – (Optional) The default value for this attribute. Assets created from the model have this value for the attribute. For more information about how to override the default value in an asset created from a model, see [Update attribute values](update-attribute-values.md).
+ <a name="asset-property-data-type-console"></a>**Data type** – The property's data type, which is one of the following:
  + **String** – A string with up to 1024 bytes.
  + **Integer** – A signed 32-bit integer with range [-2,147,483,648, 2,147,483,647].
  + **Double** – A floating point number with range [-10^100, 10^100] and IEEE 754 double precision.
  + **Boolean** – `true` or `false`.
+ **External ID** – (Optional) This is a user-defined ID. For more information, see [Reference objects with external IDs](object-ids.md#external-id-references) in the *AWS IoT SiteWise User Guide*.

For more information, see [Create an asset model (console)](create-asset-models.md#create-asset-model-console).

## Define attributes (AWS CLI)


When you define an attribute for an asset model with the AWS IoT SiteWise API, you specify the following parameters:
+ <a name="asset-property-name-cli"></a>`name` – The property's name.
+ `defaultValue` – (Optional) The default value for this attribute. Assets created from the model have this value for the attribute. For more information about how to override the default value in an asset created from a model, see [Update attribute values](update-attribute-values.md).
+ <a name="asset-property-data-type-cli"></a>`dataType` – The property's data type, which is one of the following:
  + `STRING` – A string with up to 1024 bytes.
  + `INTEGER` – A signed 32-bit integer with range [-2,147,483,648, 2,147,483,647].
  + `DOUBLE` – A floating point number with range [-10^100, 10^100] and IEEE 754 double precision.
  + `BOOLEAN` – `true` or `false`.
+ `externalId` – (Optional) This is a user-defined ID. For more information, see [Reference objects with external IDs](object-ids.md#external-id-references) in the *AWS IoT SiteWise User Guide*.

**Example attribute definition**  
The following example demonstrates an attribute that represents an asset's model number with a default value. This object is an example of an [AssetModelProperty](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_AssetModelProperty.html) that contains an [Attribute](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_Attribute.html). You can specify this object as a part of the [CreateAssetModel](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_CreateAssetModel.html) request payload to create an attribute property. For more information, see [Create an asset model (AWS CLI)](create-asset-models.md#create-asset-model-cli).  

```
{
...
"assetModelProperties": [
{
  "name": "Model number",
  "dataType": "STRING",
  "type": {
    "attribute": {
      "defaultValue": "BLT123"
    }
  }
}
],
...
}
```

# Define data streams from equipment (measurements)
Define data streams from equipment (measurement)

A *measurement* represents a device's raw sensor data stream, such as timestamped temperature values or timestamped rotations per minute (RPM) values.

**Topics**
+ [

## Define measurements (console)
](#define-measurements-console)
+ [

## Define measurements (AWS CLI)
](#define-measurements-cli)

## Define measurements (console)


When you define a measurement for an asset model in the AWS IoT SiteWise console, you specify following parameters:
+ <a name="asset-property-name-console"></a>**Name** – The property's name.
+ <a name="asset-property-unit-console"></a>**Unit** – (Optional) The scientific unit for the property, such as mm or Celsius.
+ <a name="asset-property-data-type-console"></a>**Data type** – The property's data type, which is one of the following:
  + **String** – A string with up to 1024 bytes.
  + **Integer** – A signed 32-bit integer with range [-2,147,483,648, 2,147,483,647].
  + **Double** – A floating point number with range [-10^100, 10^100] and IEEE 754 double precision.
  + **Boolean** – `true` or `false`.
+ **External ID** – (Optional) This is a user-defined ID. For more information, see [Reference objects with external IDs](object-ids.md#external-id-references) in the *AWS IoT SiteWise User Guide*.

For more information, see [Create an asset model (console)](create-asset-models.md#create-asset-model-console).

## Define measurements (AWS CLI)


When you define a measurement for an asset model with the AWS IoT SiteWise API, you specify the following parameters:
+ <a name="asset-property-name-cli"></a>`name` – The property's name.
+ <a name="asset-property-data-type-cli"></a>`dataType` – The property's data type, which is one of the following:
  + `STRING` – A string with up to 1024 bytes.
  + `INTEGER` – A signed 32-bit integer with range [-2,147,483,648, 2,147,483,647].
  + `DOUBLE` – A floating point number with range [-10^100, 10^100] and IEEE 754 double precision.
  + `BOOLEAN` – `true` or `false`.
+ <a name="asset-property-unit-cli"></a>`unit` – (Optional) The scientific unit for the property, such as mm or Celsius.
+ `externalId` – (Optional) This is a user-defined ID. For more information, see [Reference objects with external IDs](object-ids.md#external-id-references) in the *AWS IoT SiteWise User Guide*.

**Example measurement definition**  
The following example demonstrates a measurement that represents an asset's temperature sensor readings. This object is an example of an [AssetModelProperty](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_AssetModelProperty.html) that contains a [Measurement](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_Measurement.html). You can specify this object as a part of the [CreateAssetModel](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_CreateAssetModel.html) request payload to create a measurement property. For more information, see [Create an asset model (AWS CLI)](create-asset-models.md#create-asset-model-cli).  
The [Measurement](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_Measurement.html) structure is an empty structure when you define an asset model because you later configure each asset to use unique device data streams. For more information about how to connect an asset's measurement property to a device's sensor data stream, see [Manage data streams for AWS IoT SiteWise](manage-data-streams.md).  

```
{
      ...
      "assetModelProperties": [
      {
          "name": "Temperature C",
          "dataType": "DOUBLE",
          "type": {
              "measurement": {}
          },
          "unit": "Celsius"
      }
  ],
      ...
}
```

# Transform data (transforms)
Transform data (transforms)

*Transforms* are mathematical expressions that map asset properties' data points from one form to another. A transform expression consists of asset property variables, literals, operators, and functions. The transformed data points hold a one-to-one relationship with the input data points. AWS IoT SiteWise calculates a new transformed data point each time any of the input properties receives a new data point.

**Note**  
For property updates with the same timestamp, output values may be overwritten by updates from other incoming properties.

For example, if your asset has a temperature measurement stream named `Temperature_C` with units in Celsius, you can convert each data point to Fahrenheit with the formula `Temperature_F = 9/5 * Temperature_C + 32`. Each time AWS IoT SiteWise receives a data point in the `Temperature_C` measurement stream, the corresponding `Temperature_F` value is calculated within a few seconds and available as the `Temperature_F` property.

If your transform contains more than one variable, the data point that arrives earlier initiates the computation immediately. Consider an example where a parts manufacturer uses a transform to monitor product quality. Using a different standard based on the part type, the manufacturer uses the following measurements to represent the process:
+ `Part_Number` - A string that identifies the part type.
+ `Good_Count` - An integer that increases by one if the part meets the standard.
+ `Bad_Count` - An integer that increases by one if the part doesn't meet the standard.

The manufacturer also creates a transform, `Quality_Monitor`, that equals ` if(eq(Part_Number, "BLT123") and (Bad_Count / (Good_Count + Bad_Count) > 0.1), "Caution", "Normal")`.

This transform monitors the percentage of bad parts produced for a specific part type. If the part number is BLT123 and the percentage of bad parts exceeds 10 percent (0.1), the transform returns `"Caution"`. Otherwise, the transform returns `"Normal"`.

**Note**  
If `Part_Number` receives a new data point before other measurements, the `Quality_Monitor` transform uses the new `Part_Number` value and the latest `Good_Count` and `Bad_Count` values. To avoid errors, reset `Good_Count` and `Bad_Count` before the next manufacturing run.
Use [metrics](metrics.md) if you want to evaluate expressions only after all variables receive new data points.

**Topics**
+ [

## Define transforms (console)
](#define-transforms-console)
+ [

## Define transforms (AWS CLI)
](#define-transform-cli)

## Define transforms (console)


When you define a transform for an asset model in the AWS IoT SiteWise console, you specify following parameters:
+ <a name="asset-property-name-console"></a>**Name** – The property's name.
+ <a name="asset-property-unit-console"></a>**Unit** – (Optional) The scientific unit for the property, such as mm or Celsius.
+ **Data type** – The data type of the transform, which can be **Double** or **String**.
+ **External ID** – (Optional) This is a user-defined ID. For more information, see [Reference objects with external IDs](object-ids.md#external-id-references) in the *AWS IoT SiteWise User Guide*.
+ **Formula** – The transform expression. Transform expressions can't use aggregation functions or temporal functions. To open the auto complete feature, start typing or press the down arrow key. For more information, see [Use formula expressions](formula-expressions.md).
**Important**  <a name="transform-input-rules"></a>
Transforms can input properties that are integer, double, Boolean, or string type. Booleans convert to `0` (false) and `1` (true).  
Transforms must input one or more properties that aren't attributes and any number of attribute properties. AWS IoT SiteWise calculates a new transformed data point each time the input property that isn't an attribute receives a new data point. New attribute values don't launch transform updates. The same request rate for asset property data API operations applies for transform computation results.  
<a name="formula-output-rules"></a>Formula expressions can only output double or string values. Nested expressions can output other data types, such as strings, but the formula as a whole must evaluate to a number or string. You can use the [jp function](expression-string-functions.md#jp-definition) to convert a string to a number. The Boolean value must be 1 (true) or 0 (false). For more information, see [Undefined, infinite, and overflow values](expression-tutorials.md#undefined-values).

For more information, see [Create an asset model (console)](create-asset-models.md#create-asset-model-console).

## Define transforms (AWS CLI)


When you define a transform for an asset model with the AWS IoT SiteWise API, you specify the following parameters:
+ <a name="asset-property-name-cli"></a>`name` – The property's name.
+ <a name="asset-property-unit-cli"></a>`unit` – (Optional) The scientific unit for the property, such as mm or Celsius.
+ `dataType` – The data type of the transform, which must be `DOUBLE` or `STRING`.
+ `externalId` – (Optional) This is a user-defined ID. For more information, see [Reference objects with external IDs](object-ids.md#external-id-references) in the *AWS IoT SiteWise User Guide*.
+ `expression` – The transform expression. Transform expressions can't use aggregation functions or temporal functions. For more information, see [Use formula expressions](formula-expressions.md).
+ `variables` – The list of variables that defines the other properties of your asset to use in the expression. Each variable structure contains a simple name to use in the expression and a `value` structure that identifies which property to link to that variable. The `value` structure contains the following information:
  + `propertyId` – The ID of the property from which to input values. You can use the property's name instead of its ID.
**Important**  <a name="transform-input-rules"></a>
Transforms can input properties that are integer, double, Boolean, or string type. Booleans convert to `0` (false) and `1` (true).  
Transforms must input one or more properties that aren't attributes and any number of attribute properties. AWS IoT SiteWise calculates a new transformed data point each time the input property that isn't an attribute receives a new data point. New attribute values don't launch transform updates. The same request rate for asset property data API operations applies for transform computation results.  
<a name="formula-output-rules"></a>Formula expressions can only output double or string values. Nested expressions can output other data types, such as strings, but the formula as a whole must evaluate to a number or string. You can use the [jp function](expression-string-functions.md#jp-definition) to convert a string to a number. The Boolean value must be 1 (true) or 0 (false). For more information, see [Undefined, infinite, and overflow values](expression-tutorials.md#undefined-values).

**Example transform definition**  
The following example demonstrates a transform property that converts an asset's temperature measurement data from Celsius to Fahrenheit. This object is an example of an [AssetModelProperty](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_AssetModelProperty.html) that contains a [Transform](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_Transform.html). You can specify this object as a part of the [CreateAssetModel](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_CreateAssetModel.html) request payload to create a transform property. For more information, see [Create an asset model (AWS CLI)](create-asset-models.md#create-asset-model-cli).  

```
{
...
"assetModelProperties": [
...
{
  "name": "Temperature F",
  "dataType": "DOUBLE",
  "type": {
    "transform": {
      "expression": "9/5 * temp_c + 32",
      "variables": [
        {
          "name": "temp_c",
          "value": {
            "propertyId": "Temperature C"
          }
        }
      ]
    }
  },
  "unit": "Fahrenheit"
}
],
...
}
```

**Example transform definition that contains three variables**  
The following example demonstrates a transform property that returns a warning message (`"Caution"`) if more than 10 percent of the BLT123 parts don't meet the standard. Otherwise, it returns an information message (`"Normal"`).  

```
{
...
"assetModelProperties": [
...
{
"name": "Quality_Monitor",
"dataType": "STRING",
"type": {
    "transform": {
        "expression": "if(eq(Part_Number,"BLT123") and (Bad_Count / (Good_Count + Bad_Count) > 0.1), "Caution", "Normal")",
        "variables": [
            {
                "name": "Part_Number",
                "value": {
                    "propertyId": "Part Number"
                }
            },
            {
                "name": "Good_Count",
                "value": {
                    "propertyId": "Good Count"
                }
            },
            {
                "name": "Bad_Count",
                "value": {
                    "propertyId": "Bad Count"
                }
            }
        ]
    }
}
}
...
}
```

# Aggregate data from properties and other assets (metrics)
Aggregate data (metrics)

Metrics are mathematical expressions that use aggregation functions to process all input data points and output a single data point per specified time interval. For example, a metric can calculate the average hourly temperature from a temperature data stream.

Metrics can input data from associated assets' metrics, so you can calculate statistics that provide insight to your operation or a subset of your operation. For example, a metric can calculate the average hourly temperature across all wind turbines in a wind farm. For more information about how to define associations between assets, see [Define asset model hierarchies](define-asset-hierarchies.md).

Metrics can also input data from other properties without aggregating data over each time interval. If you specify an [attribute](attributes.md) in a formula, AWS IoT SiteWise uses the [latest](expression-temporal-functions.md#latest-definition) value for that attribute when it computes the formula. If you specify a metric in a formula, AWS IoT SiteWise uses the [last](expression-temporal-functions.md#last-definition) value for the time interval over which it computes the formula. This means you can define metrics like `OEE = Availability * Quality * Performance`, where `Availability`, `Quality`, and `Performance` are all other metrics on the same asset model.

AWS IoT SiteWise also automatically computes a set of basic aggregation metrics for all asset properties. To reduce computation costs, you can use these aggregates instead of defining custom metrics for basic computations. For more information, see [Query asset property aggregates in AWS IoT SiteWise](aggregates.md).

**Topics**
+ [

## Define metrics (console)
](#define-metrics-console)
+ [

## Define metrics (AWS CLI)
](#define-metrics-cli)

## Define metrics (console)


When you define a metric for an asset model in the AWS IoT SiteWise console, you specify the following parameters:
+ <a name="asset-property-name-console"></a>**Name** – The property's name.
+ **Data type** – The data type of the transform, which can be **Double** or **String**.
+ **External ID** – (Optional) This is a user-defined ID. For more information, see [Reference objects with external IDs](object-ids.md#external-id-references) in the *AWS IoT SiteWise User Guide*.
+ **Formula** – The metric expression. Metric expressions can use [aggregation functions](expression-aggregation-functions.md) to input data from a property for all associated assets in a hierarchy. Start typing or press the down arrow key to open the auto complete feature. For more information, see [Use formula expressions](formula-expressions.md).
**Important**  <a name="metric-input-rules"></a>
Metrics can only be properties that are integer, double, Boolean, or string type. Booleans convert to `0` (false) and `1` (true).  
If you define any metric input variables in a metric's expression, those inputs must have the same time interval as the output metric.  
<a name="formula-output-rules"></a>Formula expressions can only output double or string values. Nested expressions can output other data types, such as strings, but the formula as a whole must evaluate to a number or string. You can use the [jp function](expression-string-functions.md#jp-definition) to convert a string to a number. The Boolean value must be 1 (true) or 0 (false). For more information, see [Undefined, infinite, and overflow values](expression-tutorials.md#undefined-values).
+ **Time interval** – The metric time interval. <a name="metric-window-info"></a>AWS IoT SiteWise supports the following tumbling window time intervals, where each interval starts when the previous one ends:
  + **1 minute** – <a name="metric-window-1m"></a>1 minute, computed at the end of each minute (12:00:00 AM, 12:01:00 AM, 12:02:00 AM, and so on).
  + **5 minutes** – <a name="metric-window-5m"></a>5 minutes, computed at the end of every five minutes starting on the hour (12:00:00 AM, 12:05:00 AM, 12:10:00 AM, and so on).
  + **15 minutes** – <a name="metric-window-15m"></a>15 minutes, computed at the end of every fifteen minutes starting on the hour (12:00:00 AM, 12:15:00 AM, 12:30:00 AM, and so on).
  + **1 hour** – <a name="metric-window-1h"></a>1 hour (60 minutes), computed at the end of every hour in UTC (12:00:00 AM, 01:00:00 AM, 02:00:00 AM, and so on).
  + **1 day** – <a name="metric-window-1d"></a>1 day (24 hours), computed at the end of every day in UTC (12:00:00 AM Monday, 12:00:00 AM Tuesday, and so on).
  + **1 week** – <a name="metric-window-1w"></a>1 week (7 days), computed at the end of every Sunday in UTC (every 12:00:00 AM Monday).
  + **Custom interval** – You can enter any time interval between a minute and a week.
+ **Offset date** – (Optional) The reference date from which to aggregate data.
+ **Offset time** – (Optional) The reference time from which to aggregate data. The offset time must be between 00:00:00 and 23:59:59.
+ **Offset time zone** – (Optional) The time zone for the offset. If it isn't specified, the default offset time zone is the Universal Coordinated Time (UTC). See the following supported time zones.

### Supported time zones

+ (UTC\$100:00) Universal Coordinated Time
+ (UTC\$101:00) European Central Time
+ (UTC\$102:00) Eastern European
+ (UTC03\$1:00) Eastern African Time
+ (UTC\$104:00) Near East Time
+ (UTC\$105:00) Pakistan Lahore Time
+ (UTC\$105:30) India Standard Time
+ (UTC\$106:00) Bangladesh Standard Time
+ (UTC\$107:00) Vietnam Standard Time
+ (UTC\$108:00) China Taiwan Time
+ (UTC\$109:00) Japan Standard Time
+ (UTC\$109:30) Australia Central Time
+ (UTC\$110:00) Australia Eastern Time
+ (UTC\$111:00) Solomon Standard Time
+ (UTC\$112:00) New Zealand Standard Time
+ (UTC-11:00) Midway Islands Time
+ (UTC-10:00) Hawaii Standard Time
+ (UTC-09:00) Alaska Standard Time
+ (UTC-08:00) Pacific Standard Time
+ (UTC-07:00) Phoenix Standard Time
+ (UTC-06:00) Central Standard Time
+ (UTC-05:00) Eastern Standard Time
+ (UTC-04:00) Puerto Rico and US Virgin Islands Time
+ (UTC-03:00) Argentina Standard Time
+ (UTC-02:00) South Georgia Time
+ (UTC-01:00) Central African Time

**Example custom time interval with an offset (console)**  
The following example shows you how to define a 12-hour time interval with an offset on February 20, 2021, at 6:30:30 PM (PST).  

**To define a custom interval with an offset**

1. For **Time interval**, choose **Custom interval**.

1. For **Time interval**, do one of the following:
   + Enter **12**, and then choose **hours**.
   + Enter **720**, and then choose **minutes**.
   + Enter **43200**, and then choose **seconds**.
**Important**  
The **Time interval** must be an integer regardless of the unit.

1. For **Offset date**, choose **2021/02/20**.

1. For **Offset time**, enter **18:30:30**.

1. For **Offset timezone**, choose **(UTC-08:00) Pacific Standard Time**.
If you create the metric on July 1, 2021, before or at 06:30:30 PM (PST), you get the first aggregation result on July 1, 2021, at 06:30:30 PM (PST). The second aggregation result is on July 2, 2021, at 06:30:30 AM (PST), and so on.

## Define metrics (AWS CLI)


When you define a metric for an asset model with the AWS IoT SiteWise API, you specify the following parameters:
+ <a name="asset-property-name-cli"></a>`name` – The property's name.
+ `dataType` – The data type of the metric, which can be `DOUBLE` or `STRING`.
+ `externalId` – (Optional) This is a user-defined ID. For more information, see [Reference objects with external IDs](object-ids.md#external-id-references) in the *AWS IoT SiteWise User Guide*.
+ `expression` – The metric expression. Metric expressions can use [aggregation functions](expression-aggregation-functions.md) to input data from a property for all associated assets in a hierarchy. For more information, see [Use formula expressions](formula-expressions.md).
+ `window` – The time interval and offset for the metric's tumbling window, where each interval starts when the previous one ends:
  + `interval` – The time interval for the tumbling window. The time interval must be between a minute and a week.
  + `offsets` – The offset for the tumbling window. 

  For more information, see [TumblingWindow](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_TumblingWindow.html) in the *AWS IoT SiteWise API Reference*.  
**Example custom time interval with an offset (AWS CLI)**  

  The following example shows you how to define a 12-hour time interval with an offset on February 20, 2021, at 06:30:30 PM (PST).

  ```
  {
      "window": {
          "tumbling": {
              "interval": "12h",
              "offset": " 2021-07-23T18:30:30-08"
          }
      }
  }
  ```

  If you create the metric on July 1, 2021, before or at 06:30:30 PM (PST), you get the first aggregation result on July 1, 2021, at 06:30:30 PM (PST). The second aggregation result is on July 2, 2021, at 06:30:30 AM (PST), and so on.
+ `variables` – The list of variables that defines the other properties of your asset or child assets to use in the expression. Each variable structure contains a simple name for use in the expression and a `value` structure that identifies which property to link to that variable. The `value` structure contains the following information:
  + `propertyId` – The ID of the property from which to pull values. You can use the property's name instead of its ID if the property is defined in the current model (rather than defined in a model from a hierarchy).
  + `hierarchyId` – (Optional) The ID of the hierarchy from which to query child assets for the property. You can use the hierarchy definition's name instead of its ID. If you omit this value, AWS IoT SiteWise finds the property in the current model.
**Important**  <a name="metric-input-rules"></a>
Metrics can only be properties that are integer, double, Boolean, or string type. Booleans convert to `0` (false) and `1` (true).  
If you define any metric input variables in a metric's expression, those inputs must have the same time interval as the output metric.  
<a name="formula-output-rules"></a>Formula expressions can only output double or string values. Nested expressions can output other data types, such as strings, but the formula as a whole must evaluate to a number or string. You can use the [jp function](expression-string-functions.md#jp-definition) to convert a string to a number. The Boolean value must be 1 (true) or 0 (false). For more information, see [Undefined, infinite, and overflow values](expression-tutorials.md#undefined-values).
+ <a name="asset-property-unit-cli"></a>`unit` – (Optional) The scientific unit for the property, such as mm or Celsius.

**Example metric definition**  
The following example demonstrates a metric property that aggregates an asset's temperature measurement data to calculate maximum hourly temperature in Fahrenheit. This object is an example of an [AssetModelProperty](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_AssetModelProperty.html) that contains a [Metric](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_Metric.html). You can specify this object as a part of the [CreateAssetModel](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_CreateAssetModel.html) request payload to create a metric property. For more information, see [Create an asset model (AWS CLI)](create-asset-models.md#create-asset-model-cli).  

```
{
      ...
      "assetModelProperties": [
      ...
      {
        "name": "Max temperature",
        "dataType": "DOUBLE",
        "type": {
          "metric": {
            "expression": "max(temp_f)",
            "variables": [
              {
                "name": "temp_f",
                "value": {
                  "propertyId": "Temperature F"
                }
              }
            ],
            "window": {
              "tumbling": {
                "interval": "1h"
              }
            }
          }
        },
        "unit": "Fahrenheit"
      }
    ],
    ...
}
```

**Example metric definition that inputs data from associated assets**  
The following example demonstrates a metric property that aggregates multiple wind turbines' average power data to calculate total average power for a wind farm. This object is an example of an [AssetModelProperty](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_AssetModelProperty.html) that contains a [Metric](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_Metric.html). You can specify this object as a part of the [CreateAssetModel](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_CreateAssetModel.html) request payload to create a metric property.   

```
{
      ...
      "assetModelProperties": [
      ...
      {
          "name": "Total Average Power",
          "dataType": "DOUBLE",
          "type": {
            "metric": {
              "expression": "avg(power)",
              "variables": [
                {
                  "name": "power",
                  "value": {
                    "propertyId": "a1b2c3d4-5678-90ab-cdef-11111EXAMPLE",
                    "hierarchyId": "Turbine Asset Model"
                  }
                }
              ],
              "window": {
                "tumbling": {
                  "interval": "5m"
                }
              }
            }
        },
        "unit": "kWh"
      }
    ],
    ...
}
```

# Use formula expressions


With formula expressions, you can define the mathematical functions to transform and aggregate your raw industrial data to gain insights about your operation. Formula expressions combine literals, operators, functions, and variables to process data. For more information about how to define asset properties that use formula expressions, see [Transform data (transforms)](transforms.md) and [Aggregate data from properties and other assets (metrics)](metrics.md). Transforms and metrics are formula properties.

**Topics**
+ [

# Use variables in formula expressions
](expression-variables.md)
+ [

# Use literals in formula expressions
](expression-literals.md)
+ [

# Use operators in formula expressions
](expression-operators.md)
+ [

# Use constants in formula expressions
](expression-constants.md)
+ [

# Use functions in formula expressions
](expression-functions.md)
+ [

# Formula expression tutorials
](expression-tutorials.md)

# Use variables in formula expressions
Use variables

Variables represent AWS IoT SiteWise asset properties in formula expressions. Use variables to input values from other asset properties in your expressions, so that you can process data from constant properties ([attributes](attributes.md)), raw data streams ([measurements](measurements.md)), and other formula properties.

Variables can represent asset properties from the same asset model or from associated child asset models. Only metric formulas can input variables from child asset models.

You identify variables by different names in the console and the API.
+ **AWS IoT SiteWise console** – Use asset property names as variables in your expressions.
+ **AWS IoT SiteWise API (AWS CLI, AWS SDKs)** – Define variables with the [ExpressionVariable](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_ExpressionVariable.html) structure, which requires a variable name and a reference to an asset property. The variable name can contain lowercase letters, numbers, and underscores. Then, use variable names to reference asset properties in your expressions.

Variable names are case sensitive.

For more information, see [Defining transforms](transforms.md) and [Defining metrics](metrics.md).

## Use variables to reference properties


A variable's *value* defines the property that it references. AWS IoT SiteWise provides different ways to do this.
+ **By property ID:** You can specify the property's unique ID (UUID) to identify it.
+ **By name:** If the property is on the same asset model, you can specify its name in the property ID field.
+ **By path:** A variable value can refer to a property by its *path.* For more information, see [Use paths to reference custom composite model properties](custom-composite-models.md#property-paths).

**Note**  
 Variables are not supported by AWS IoT SiteWise console. They are used by AWS IoT SiteWise API, including the AWS Command Line Interface AWS CLI) and AWS SDKs. 

 A variable that you receive in a response from AWS IoT SiteWise includes full information about the value, including both the ID and the path.

 However, when you pass a variable into AWS IoT SiteWise (for example, in a "create" or "update" call), you only need to specify one of these. For example, if you specify the path, you don't need to provide the ID. 

# Use literals in formula expressions
Use literals

AWS IoT SiteWise supports the use of literals in expressions and formulas. Literals are fixed values that represent a specific data type. In AWS IoT SiteWise, you can define number and string literals in formula expressions. Literals can be used in various contexts, including data transformations, alarm conditions, and visualization calculations.


+ <a name="number-literal-definition"></a>**Numbers**

  Use numbers and scientific notation to define integers and doubles. You can use [E notation](https://en.wikipedia.org/wiki/Scientific_notation#E_notation) to express numbers with scientific notation.

  Examples: `1`, `2.0`, `.9`, `-23.1`, `7.89e3`, `3.4E-5`
+ <a name="string-literal-definition"></a>**Strings**

  Use the `'` (quote) and `"` (double quote) characters to define strings. The quote type for the start and end must match. To escape a quote that matches the one that you use to declare a string, include that quote character twice. This is the only escape character in AWS IoT SiteWise strings.

  Examples: `'active'`, `"inactive"`, `'{"temp": 52}'`, `"{""temp"": ""high""}"`

# Use operators in formula expressions
Use operators

You can use the following common operators in formula expressions.


| Operator | Description | 
| --- | --- | 
|  `+`  |  If both operands are numbers, this operator adds the left and right operands. If either operand is a string, this operator concatenates the left and right operands as strings. For example, the expression `1 + 2 + " is three"` evaluates to `"3 is three"`. The concatenated string can have up to 1024 characters. If the string exceeds 1024 characters, then AWS IoT SiteWise doesn't output a data point for that computation.  | 
|  `-`  |  Subtracts the right operand from the left operand. <a name="operator-numbers-only"></a>You can only use this operator with numeric operands.  | 
|  `/`  |  Divides the left operand by the right operand. <a name="operator-numbers-only"></a>You can only use this operator with numeric operands.  | 
|  `*`  |  Multiplies the left and right operands. <a name="operator-numbers-only"></a>You can only use this operator with numeric operands.  | 
|  `^`  |  Raises the left operand to the power of the right operand (exponentiation). <a name="operator-numbers-only"></a>You can only use this operator with numeric operands.  | 
|  `%`  |  Returns the remainder from dividing the left operand by the right operand. The result has the same sign as the left operand. This behavior differs from the modulo operation. <a name="operator-numbers-only"></a>You can only use this operator with numeric operands.  | 
|  `x < y`  |  Returns `1` if `x` is less than `y`, otherwise `0`.  | 
|  `x > y`  |  Returns `1` if `x` is greater than `y`, otherwise `0`.  | 
|  `x <= y`  |  Returns `1` if `x` is less than or equal to `y`, otherwise `0`.  | 
|  `x >= y`  |  Returns `1` if `x` is greater than or equal to `y`, otherwise `0`.  | 
|  `x == y`  |  Returns `1` if `x` is equal to `y`, otherwise `0`.  | 
|  `x != y`  |  Returns `1` if `x` is not equal to `y`, otherwise `0`.  | 
|  `!x`  |  Returns `1` if `x` is evaluated to `0` (false), otherwise `0`. `x` is evaluated to false if:  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/expression-operators.html)  | 
|  `x and y`  |  Returns `0` if `x` is evaluated to `0` (false). Otherwise, returns the evaluated result of `y`. `x` or `y` is evaluated to false if:  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/expression-operators.html)  | 
|  `x or y`  |  Returns `1` if `x` is evaluated to `1` (true). Otherwise, returns the evaluated result of `y`. `x` or `y` is evaluated to false if:  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/expression-operators.html)  | 
|  `not x`  |  Returns `1` if `x` is evaluated to `0` (false), otherwise `0`. `x` is evaluated to false if:  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/expression-operators.html)  | 
|   `[]` `s[index]`  |  Returns the character at an index `index` of the string `s`. This is equivalent to the index syntax in Python. 

**Examples**  
+ `"Hello!"[1]` returns `e`.
+ `"Hello!"[-2]` returns `o`.  | 
|   `[]` `s[start:end:step]`  |  Returns a slice of the string `s`. This is equivalent to the slice syntax in Python. This operator has the following arguments: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/expression-operators.html) You can omit the `step` argument to use its default value. For example, `s[1:4:1]` is equivalent to `s[1:4]`. The arguments must be integers or the [none](expression-constants.md#none-definition) constant. If you specify `none`, AWS IoT SiteWise uses the default value for that argument. 

**Examples**  
+ `"Hello!"[1:4]` returns `"ell"`.
+ `"Hello!"[:2]` returns `"He"`.
+ `"Hello!"[3:]` returns `"lo!"`.
+ `"Hello!"[:-4]` returns `"He"`.
+ `"Hello!"[::2]` returns `"Hlo"`.
+ `"Hello!"[::-1]` returns `"!olleH"`.  | 

# Use constants in formula expressions
Use constants

In AWS IoT SiteWise, you can use constants in your expressions and formulas to represent fixed values or predefined parameters. Constants can be used in various contexts, such as data transformations, alarm conditions, or visualization calculations. By using constants, you can simplify your expressions and make them more readable and maintainable.

You can use the following common mathematical constants in your expressions. All constants are case insensitive.

**Note**  
If you define a variable with the same name as a constant, the variable overrides the constant.


| Constant | Description | 
| --- | --- | 
|  `pi`  |  The number pi (`π`): `3.141592653589793`  | 
|  `e`  |  The number e: `2.718281828459045`  | 
|  `true`  |  Equivalent to the number 1. In AWS IoT SiteWise, Booleans convert to their number equivalents.  | 
|  `false`  |  Equivalent to the number 0. In AWS IoT SiteWise, Booleans convert to their number equivalents.  | 
|   `none`  |  Equivalent to no value. You can use this constant to output nothing as the result of a [conditional expression](expression-conditional-functions.md).  | 

# Use functions in formula expressions
Use functions

You can use the following functions to operate on data in your formula expressions.

Transforms and metrics support different functions. The following table indicates which types of functions are compatible with each type of formula property.

**Note**  
You can include a maximum of 10 functions in a formula expression.


| Function type | Transforms | Metrics | 
| --- | --- | --- | 
|  [Use common functions in formula expressions](expression-common-functions.md)  |  <a name="polaris-yes-para"></a>![\[A green circle with a checkmark for yes.\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/images/icon-yes.png) Yes  |  <a name="polaris-yes-para"></a>![\[A green circle with a checkmark for yes.\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/images/icon-yes.png) Yes  | 
|  [Use comparison functions in formula expressions](expression-comparison-functions.md)  |  <a name="polaris-yes-para"></a>![\[A green circle with a checkmark for yes.\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/images/icon-yes.png) Yes  |  <a name="polaris-yes-para"></a>![\[A green circle with a checkmark for yes.\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/images/icon-yes.png) Yes  | 
|  [Use conditional functions in formula expressions](expression-conditional-functions.md)  |  <a name="polaris-yes-para"></a>![\[A green circle with a checkmark for yes.\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/images/icon-yes.png) Yes  |  <a name="polaris-yes-para"></a>![\[A green circle with a checkmark for yes.\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/images/icon-yes.png) Yes  | 
|  [Use string functions in formula expressions](expression-string-functions.md)  |  <a name="polaris-yes-para"></a>![\[A green circle with a checkmark for yes.\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/images/icon-yes.png) Yes  |  <a name="polaris-yes-para"></a>![\[A green circle with a checkmark for yes.\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/images/icon-yes.png) Yes  | 
|  [Use aggregation functions in formula expressions](expression-aggregation-functions.md)  |  <a name="polaris-no-para"></a>![\[A red circle with the letter x for no.\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/images/icon-no.png) No  |  <a name="polaris-yes-para"></a>![\[A green circle with a checkmark for yes.\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/images/icon-yes.png) Yes  | 
|  [Use temporal functions in formula expressions](expression-temporal-functions.md)  |  <a name="polaris-yes-para"></a>![\[A green circle with a checkmark for yes.\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/images/icon-yes.png) Yes  |  <a name="polaris-yes-para"></a>![\[A green circle with a checkmark for yes.\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/images/icon-yes.png) Yes  | 
|  [Use date and time functions in formula expressions](expression-date-and-time-functions.md)  |  <a name="polaris-yes-para"></a>![\[A green circle with a checkmark for yes.\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/images/icon-yes.png) Yes  |  <a name="polaris-yes-para"></a>![\[A green circle with a checkmark for yes.\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/images/icon-yes.png) Yes  | 

## Function syntax


You can use the following syntax to create functions:

Regular syntax  
With the regular syntax, the function name is followed by parentheses with zero or more arguments.  
`function_name(argument1, argument2, argument3, ...)`. For example, functions with the regular syntax might look like `log(x)` and `contains(s, substring)`.

Uniform function call syntax (UFCS)  
UFCS enables you to call functions using the syntax for method calls in object-oriented programming. With UFCS, the first argument is followed by dot (`.`), then the function name and the remaining arguments (if any) inside parentheses.  
`argument1.function_name(argument2, argument3, ...)`. For example, functions with UFCS might look like `x.log()` and `s.contains(substring)`.  
You can also use UFCS to chain subsequent functions. AWS IoT SiteWise uses the evaluation result of the current function as the first argument for the next function.  
For example, you can use `message.jp('$.status').lower().contains('fail')` instead of `contains(lower(jp(message, '$.status')),'fail')`.  
For more information, visit the [D Programming Language](https://tour.dlang.org/tour/en/gems/uniform-function-call-syntax-ufcs) website.

**Note**  
You can use UFCS for all AWS IoT SiteWise functions.  
AWS IoT SiteWise functions are not case sensitive. For example, you can use `lower(s)` and `Lower(s)` interchangeably.

# Use common functions in formula expressions
Use common functions

In [transforms](transforms.md) and [metrics](metrics.md), you can use the following functions to calculate common mathematical functions in transforms and metrics.


| Function | Description | 
| --- | --- | 
|  `abs(x)`  |  Returns the absolute value of `x`.  | 
|  `acos(x)`  |  Returns the arccosine of `x`.  | 
|  `asin(x)`  |  Returns the arcsine of `x`.  | 
|  `atan(x)`  |  Returns the arctangent of `x`.  | 
|  `cbrt(x)`  |  Returns the cubic root of `x`.  | 
|  `ceil(x)`  |  Returns the nearest integer greater than `x`.  | 
|  `cos(x)`  |  Returns the cosine of `x`.  | 
|  `cosh(x)`  |  Returns the hyperbolic cosine of `x`.  | 
|  `cot(x)`  |  Returns the cotangent of `x`.  | 
|  `exp(x)`  |  Returns `e` to the power of `x`.  | 
|  `expm1(x)`  |  Returns `exp(x) - 1`. Use this function to more accurately calculate `exp(x) - 1` for small values of `x`.  | 
|  `floor(x)`  |  Returns the nearest integer less than `x`.  | 
|  `log(x)`  |  Returns the `loge` (base `e`) of `x`.  | 
|  `log10(x)`  |  Returns the `log10` (base `10`) of `x`.  | 
|  `log1p(x)`  |  Returns `log(1 + x)`. Use this function to more accurately calculate `log(1 + x)` for small values of `x`.  | 
|  `log2(x)`  |  Returns the `log2` (base `2`) of `x`.  | 
|  `pow(x, y)`  |  Returns `x` to the power of `y`. This is equivalent to `x ^ y`.  | 
|  `signum(x)`  |  Returns the sign of `x` (`-1` for negative inputs, `0` for zero inputs, `+1` for positive inputs).  | 
|  `sin(x)`  |  Returns the sine of `x`.  | 
|  `sinh(x)`  |  Returns the hyperbolic sine of `x`.  | 
|  `sqrt(x)`  |  Returns the square root of `x`.  | 
|  `tan(x)`  |  Returns the tangent of `x`.  | 
|  `tanh(x)`  |  Returns the hyperbolic tangent of `x`.  | 

# Use comparison functions in formula expressions
Use comparison functions

In [transforms](transforms.md) and [metrics](metrics.md), you can use the following comparison functions to compare two values and output `1` (true) or `0` (false). AWS IoT SiteWise compares strings by [lexicographic order](https://en.wikipedia.org/wiki/Lexicographic_order).


| Function | Description | 
| --- | --- | 
|  `gt(x, y)`  |  Returns `1` if `x` is greater than `y`, otherwise `0` (`x > y`). <a name="comparison-function-incompatible-types"></a>This function doesn't return a value if `x` and `y` are incompatible types, such as a number and a string.  | 
|  `gte(x, y)`  |  Returns `1` if `x` is greater than or equal to `y`, otherwise `0` (`x ≥ y`). <a name="comparison-function-relative-tolerance"></a>AWS IoT SiteWise considers the arguments equal if they are within a relative tolerance of `1E-9`. This behaves similar to the [isclose](https://docs.python.org/3/library/math.html#math.isclose) function in Python. <a name="comparison-function-incompatible-types"></a>This function doesn't return a value if `x` and `y` are incompatible types, such as a number and a string.  | 
|  `eq(x, y)`  |  Returns `1` if `x` is equal to `y`, otherwise `0` (`x == y`). <a name="comparison-function-relative-tolerance"></a>AWS IoT SiteWise considers the arguments equal if they are within a relative tolerance of `1E-9`. This behaves similar to the [isclose](https://docs.python.org/3/library/math.html#math.isclose) function in Python. <a name="comparison-function-incompatible-types"></a>This function doesn't return a value if `x` and `y` are incompatible types, such as a number and a string.  | 
|  `lt(x, y)`  |  Returns `1` if `x` is less than `y`, otherwise `0` (`x < y`). <a name="comparison-function-incompatible-types"></a>This function doesn't return a value if `x` and `y` are incompatible types, such as a number and a string.  | 
|  `lte(x, y)`  |  Returns `1` if `x` is less than or equal to `y`, otherwise `0` (`x ≤ y`). <a name="comparison-function-relative-tolerance"></a>AWS IoT SiteWise considers the arguments equal if they are within a relative tolerance of `1E-9`. This behaves similar to the [isclose](https://docs.python.org/3/library/math.html#math.isclose) function in Python. <a name="comparison-function-incompatible-types"></a>This function doesn't return a value if `x` and `y` are incompatible types, such as a number and a string.  | 
|  `isnan(x)`  |  Returns `1` if `x` is equal to `NaN`, otherwise `0`. This function doesn't return a value if `x` is a string.  | 

# Use conditional functions in formula expressions
Use conditional functions

In [transforms](transforms.md) and [metrics](metrics.md), you can use the following function to check a condition and return different results, whether the condition evaluates to true or false.


| Function | Description | 
| --- | --- | 
|   `if(condition, result_if_true, result_if_false)`  |  Evaluates the `condition` and returns `result_if_true` if the condition evaluates to true or `result_if_false` if the condition evaluates to `false`. `condition` must be a number. This function considers `0` and an empty string as `false` and everything else (including `NaN`) as `true`. Booleans convert to `0` (false) and `1` (true). You can return the [none constant](expression-constants.md#none-definition) from this function to discard the output for a particular condition. This means you can filter out data points that don't meet a condition. For more information, see [Filter data points](expression-tutorials.md#filter-data). 

**Examples**  
+ `if(0, x, y)` returns the variable `y`.
+ `if(5, x, y)` returns the variable `x`.
+ `if(gt(temp, 300), x, y)` returns the variable `x` if the variable `temp` is greater than `300`.
+ `if(gt(temp, 300), temp, none)` returns the variable `temp` if it's greater than or equal to `300`, or `none` (no value) if `temp` is less than `300`. We recommend that you use UFCS for nested conditional functions where one or more arguments are conditional functions. You can use `if(condition, result_if_true)` to evaluate a condition and `elif(condition, result_if_true, result_if_false)` to evaluate additional conditions. For example, you can use `if(condition1, result1_if_true).elif(condition2, result2_if_true, result2_if_false)` instead of `if(condition1, result1_if_true, if(condition2, result2_if_true, result2_if_false))`. You can also chain additional intermediate conditional functions. For example, you can use `if(condition1, result1_if_true).elif(condition2, result2_if_true).elif(condition3, result3_if_true, result3_if_false)` instead of nesting multiple `if` statements, such as `if(condition1, result1_if_true, if(condition2, result2_if_true, if(condition3, result3_if_true result3_if_false)))`.  You must use `elif(condition, result_if_true, result_if_false)` with UFCS.   | 

# Use string functions in formula expressions
Use string functions

In [transforms](transforms.md) and [metrics](metrics.md), you can use the following functions to operate on strings. For more information, see [Use strings in formulas](expression-tutorials.md#use-strings-in-formulas).

**Important**  
<a name="formula-output-rules"></a>Formula expressions can only output double or string values. Nested expressions can output other data types, such as strings, but the formula as a whole must evaluate to a number or string. You can use the [jp function](#jp-definition) to convert a string to a number. The Boolean value must be 1 (true) or 0 (false). For more information, see [Undefined, infinite, and overflow values](expression-tutorials.md#undefined-values).


| Function | Description | 
| --- | --- | 
|  `len(s)`  |  Returns the length of the string `s`.  | 
|  `find(s, substring)`  |  Returns the index of the string `substring` in the string `s`.  | 
|  `contains(s, substring)`  |  Returns `1` if the string `s` contains the string `substring`, otherwise `0`.  | 
|  `upper(s)`  |  Returns the string `s` in uppercase form.  | 
|  `lower(s)`  |  Returns the string `s` in lowercase form.  | 
|   `jp(s, json_path)`  |  Evaluates the string `s` with the [JsonPath](https://github.com/json-path/JsonPath) expression `json_path` and returns the result. Use this function to do the following: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/expression-string-functions.html) To extract a string value from a JSON structure and return it as a number, you must use multiple nested `jp` functions. The outer `jp` function extracts the string from the JSON structure, and the inner `jp` function converts the string to a number. The string `json_path` must contain a string literal. This means that `json_path` can't be an expression that evaluates to a string. 

**Examples**  
+ `jp('{"status":"active","value":15}', '$.value')` returns `15`.
+ `jp('{"measurement":{"reading":25,"confidence":0.95}}', '$.measurement.reading')` returns `25`.
+ `jp('[2,8,23]', '$[2]')` returns `23`.
+ `jp('{"values":[3,6,7]}', '$.values[1]')` returns `6`.
+ `jp('111', '$')` returns `111`.
+ `jp(jp('{"measurement":{"reading":25,"confidence":"0.95"}}', '$.measurement.confidence'), '$')` returns `0.95`.  | 
|  `join(s0, s1, s2, s3, ...)`  |  Returns a concatenated string with a delimiter. This function uses the first input string as a delimiter and joins the remaining input strings together. This behaves similar to the [join(CharSequence delimiter, CharSequence... elements)](https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#join-java.lang.CharSequence-java.lang.CharSequence...-) function in Java. 

**Examples**  
+ `join("-", "aa", "bb", "cc")` returns `aa-bb-cc`  | 
|  `format(expression: "format")` or `format("format", expression)`  |  Returns a string in the specified format. This function evaluates `expression` to a value, and then returns the value in the specified format. This behaves similar to the [format(String format, Object... args)](https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#format-java.lang.String-java.lang.Object...-) function in Java. For more information about supported formats, see Conversions under [Class Formatter](https://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html) in the *Java Platform, Standard Edition 7 API Specification*. 

**Examples**  
+ `format(100+1: "d")` returns a string, `101`.
+ `format("The result is %d", 100+1)` returns a string, `The result is 101`.  | 
|  `f'expression'`  |  Returns a concatenated string. With this formatted function, you can use a simple expression to concatenate and format strings. These functions may contain nested expressions. You can use `{}` (curly braces) to interpolate expressions. This behaves similar to the [formatted string literals](https://docs.python.org/3/reference/lexical_analysis.html#f-strings) in Python. 

**Examples**  
+ `f'abc{1+2: "f"}d'` returns `abc3.000000d`. To evaluate this example expression, do the following:

  1. `format(1+2: "f")` returns a floating point number, `3.000000`.

  1. `join('', "abc", 1+2, 'd')` returns a string, `abc3.000000d`.

  You can also write the expression in the following way: `join('', "abc", format(1+2: "f"), 'd')`.  | 

# Use aggregation functions in formula expressions
Use aggregation functions

In [metrics](metrics.md) only, you can use the following functions that aggregate input values over each time interval and calculate a single output value. Aggregation functions can aggregate data from associated assets.

Aggregation function arguments can be [variables](expression-variables.md), [number literals](expression-literals.md#number-literal-definition), [temporal functions](expression-temporal-functions.md), nested expressions, or aggregation functions. The formula `max(latest(x), latest(y), latest(z))` uses an aggregation function as an argument and returns the largest current value of the `x`, `y`, and `z` properties.

You can use nested expressions in aggregation functions. When you use nested expressions, the following rules apply: 
+ Each argument can have only one variable.  
**Example**  

  For example, `avg(x*(x-1))` and `sum(x/2 )/avg(y^2 )` are supported.

  For example, `min(x/y)` isn't supported.
+ Each argument can have multilevel nested expressions.  
**Example**  

  For example, `sum(avg(x^2 )/2)` is supported.
+ Different arguments can have different variables.  
**Example**  

  For example, `sum(x/2, y*2)` is supported.

**Note**  
If your expressions contain measurements, AWS IoT SiteWise uses the last values over the current time interval for the measurements to compute aggregates.
If your expressions contain attributes, AWS IoT SiteWise uses the latest values for the attributes to compute aggregates.


| Function | Description | 
| --- | --- | 
|  `avg(x0, ..., xn)`  |  Returns the mean of the given variables' values over the current time interval. <a name="aggregation-function-no-output"></a>This function outputs a data point only if the given variables have at least one data point over the current time interval.  | 
|   `sum(x0, ..., xn)`  |  Returns the sum of the given variables' values over the current time interval. <a name="aggregation-function-no-output"></a>This function outputs a data point only if the given variables have at least one data point over the current time interval.  | 
|  `min(x0, ..., xn)`  |  Returns the minimum of the given variables' values over the current time interval. <a name="aggregation-function-no-output"></a>This function outputs a data point only if the given variables have at least one data point over the current time interval.  | 
|  `max(x0, ..., xn)`  |  Returns the maximum of the given variables' values over the current time interval. <a name="aggregation-function-no-output"></a>This function outputs a data point only if the given variables have at least one data point over the current time interval.  | 
|  `count(x0, ..., xn)`  |  Returns the total number of data points for the given variables over the current time interval. For more information about how to count the number of data points that meet a condition, see [Count data points that match a condition](expression-tutorials.md#count-filtered-data). <a name="aggregation-function-always-output"></a>This function computes a data point for every time interval.  | 
| `stdev(x0, ..., xn)` | Returns the standard deviation of the given variables' values over the current time interval. This function outputs a data point only if the given variables have at least one data point over the current time interval.  | 

# Use temporal functions in formula expressions
Use temporal functions

Use temporal functions to return values based on timestamps of data points.

## Use temporal functions in metrics


In [metrics](metrics.md) only, you can use the following functions that return values based on timestamps of data points.

Temporal function arguments must be properties from the local asset model or nested expressions. This means that you can't use properties from child asset models in temporal functions.

You can use nested expressions in temporal functions. When you use nested expressions, the following rules apply: 
+ Each argument can have only one variable.

  For example, `latest( t*9/5 + 32 )` is supported.
+ Arguments can't be aggregation functions.

  For example, `first( sum(x) )` isn't supported.


| Function | Description | 
| --- | --- | 
|  `first(x)`  |  Returns the given variable's value with the earliest timestamp over the current time interval.  | 
|   `last(x)` |  Returns the given variable's value with the latest timestamp over the current time interval.  | 
|  `earliest(x)`  |  Returns the given variable's last value before the start of the current time interval. This function computes a data point for every time interval, if the input property has at least one data point in its history. See [time-range-defintion](#time-range-def) for details.   | 
|   `latest(x)` |  Returns the given variable's last value with the latest timestamp before the end of the current time interval. This function computes a data point for every time interval, if the input property has at least one data point in its history. See [time-range-defintion](#time-range-def) for details.  | 
|   `statetime(x)`  |  Returns the amount of time in seconds that the given variables are positive over the current time interval. You can use the [comparison functions](expression-comparison-functions.md) to create a transform property for the `statetime` function to consume.  For example, if you have an `Idle` property that is `0` or `1`, you can calculate idle time per time interval with this expression: `IdleTime = statetime(Idle)`. For more information, see the [example statetime scenario](#statetime-example). This function doesn't support metric properties as input variables. This function computes a data point for every time interval, if the input property has at least one data point in its history.  | 
|   `TimeWeightedAvg(x, [interpolation])`  | Returns the average of input data weighted with time intervals between points.See [Time weighted functions parameters](#timeweighted-parameter) for computation and intervals details.The optional argument `interpolaton` must be a string constant:[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/expression-temporal-functions.html) | 
|   `TimeWeightedStDev(x, [algo])`  |  Returns the standard deviation of input data weighted with time intervals between points.  See [Time weighted functions parameters](#timeweighted-parameter) for computation and intervals details.  The calculation uses the Last Observed Carry Forward computation algorithm for intervals between data points. In this approach, the data point is computed as the last observed value until the next input data point time stamp. Weight is computed as time interval in seconds between data points or window boundaries.  The optional argument `algo` must be a string constant: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/expression-temporal-functions.html) The following formulas are used for computation where: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/expression-temporal-functions.html) Equation for population standard deviation: ![\[Equation for population standard deviation.\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/images/timeweightedstdev1.png) Equation for frequency standard deviation: ![\[Equation for frequency standard deviation.\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/images/timeweighted-frequency-stdev.png)  | 

The following diagram shows how AWS IoT SiteWise computes the temporal functions `first`, `last`, `earliest`, and `latest`, relative to the current time interval.

![\[AWS IoT SiteWise temporal functions return data points based on their timestamp.\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/images/sitewise-temporal-functions.png)
<a name="time-range-def"></a>

**Note**  
The time range for `first(x)`, `last(x)` is (current window start, current window end].
The time range for `latest(x)` is (beginning of time, current window end].
The time range for `earliest(x)` is (beginning of time, previous window end].

**Time-weighted functions parameters**

Time-weighted functions computed for the aggregate window take into account the following:
+ Data points inside the window
+ Time intervals between data points
+ Last data point before the window
+ First data point after the window (for some algorithms)

**Terms:**
+ **Bad data point** – Any data point with non-good quality or non-number value. This is not considered in a window result computation.
+ **Bad interval** – The interval after a bad data point. The interval before the first known data point is also considered a bad interval.
+ **Good data point** – Any data point with good quality and numeric value.

**Note**  
AWS IoT SiteWise only consumes `GOOD` quality data when it computes transforms and metrics. It ignores `UNCERTAIN` and `BAD` data points.
The interval before the first known data point is considered a **bad interval**. See [Formula expression tutorials](expression-tutorials.md) for more information.

The interval after the last known data point continues indefinitely, affecting all following windows. When a new data point arrives, the function recomputes the interval.

Following the rules above, the aggregate window result is computed and limited to window boundaries. By default, the function only sends the window result if the whole window is a **good interval**.

If the window **good interval** is smaller than the window length, the function does not send the window. 

When the data points affecting the window result change, the function recalculates the window, even if the data points are outside of the window. 

If the input property has at least one data point in its history and a computation has been initiated, the function calculates the time-weighted aggregate functions for every time interval.

**Example statetime scenario**  
Consider an example where you have an asset with the following properties:  
+ `Idle` – A measurement that is `0` or `1`. When the value is `1`, the machine is idle.
+ `Idle Time` – A metric that uses the formula `statetime(Idle)` to calculate the amount of time in seconds where the machine is idle, per 1 minute interval.
The `Idle` property has the following data points.  


|  |  |  |  |  |  | 
| --- |--- |--- |--- |--- |--- |
| Timestamp | 2:00:00 PM | 2:00:30 PM | 2:01:15 PM | 2:02:45 PM | 2:04:00 PM | 
| Idle | 0 | 1 | 1 | 0 | 0 | 
AWS IoT SiteWise calculates the `Idle Time` property every minute from the values of `Idle`. After this calculation completes, the `Idle Time` property has the following data points.  


|  |  |  |  |  |  | 
| --- |--- |--- |--- |--- |--- |
| Timestamp | 2:00:00 PM | 2:01:00 PM | 2:02:00 PM | 2:03:00 PM | 2:04:00 PM | 
| Idle Time | N/A | 30 | 60 | 45 | 0 | 
AWS IoT SiteWise performs the following calculations for `Idle Time` at the end of each minute.  
+ At 2:00 PM (for 1:59 PM to 2:00 PM)
  + There is no data for `Idle` before 2:00 PM, so no data point is calculated.
+ At 2:01 PM (for 2:00 PM to 2:01 PM)
  + At 2:00:00 PM, the machine is active (`Idle` is `0`).
  + At 2:00:30 PM, the machine is idle (`Idle` is `1`).
  + `Idle` doesn't change again before the end of the interval at 2:01:00 PM, so `Idle Time` is 30 seconds.
+ At 2:02 PM (for 2:01 PM to 2:02 PM)
  + At 2:01:00 PM, the machine is idle (per the last data point at 2:00:30 PM).
  + At 2:01:15 PM, the machine is still idle.
  + `Idle` doesn't change again before the end of the interval at 2:02:00 PM, so `Idle Time` is 60 seconds.
+ At 2:03 PM (for 2:02 PM to 2:03 PM)
  + At 2:02:00 PM, the machine is idle (per the last data point at 2:01:15 PM).
  + At 2:02:45 PM, the machine is active.
  + `Idle` doesn't change again before the end of the interval at 2:03:00 PM, so `Idle Time` is 45 seconds.
+ At 2:04 PM (for 2:03 PM to 2:04 PM)
  + At 2:03:00 PM, the machine is active (per the last data point at 2:02:45 PM).
  + `Idle` doesn't change again before the end of the interval at 2:04:00 PM, so `Idle Time` is 0 seconds.

**Example TimeWeightedAvg and TimeWeightedStDev scenario**  
The following tables provide sample inputs and outputs for these one-minute window metrics: `Avg(x), TimeWeightedAvg(x), TimeWeightedAvg(x, "linear"), stDev(x), timeWeightedStDev(x), timeWeightedStDev(x, 'p')`.  
Sample input for one-minute aggregate window:  
These data points all have `GOOD` quality.


|  |  | 
| --- |--- |
| 03:00:00 | 4.0 | 
| 03:01:00 | 2.0 | 
| 03:01:10 | 8.0 | 
| 03:01:50 | 20.0 | 
| 03:02:00 | 14.0 | 
| 03:02:05 | 10.0 | 
| 03:02:10 | 3.0 | 
| 03:02:30 | 20.0 | 
| 03:03:30 | 0.0 | 
Aggregate results output:  
None – Result not produced for this window.


| Time | `Avg(x)` | `TimeWeightedAvg(x)` | `TimeWeightedAvg(X, "linear")` | `stDev(X)` | `timeWeightedStDev(x)` | `timeWeightedStDev(x, 'p')` | 
| --- | --- | --- | --- | --- | --- | --- | 
| 3:00:00 | 4 | None | None | 0 | None | None | 
| 3:01:00 | 2 | 4 | 3 | 0 | 0 | 0 | 
| 3:02:00 | 14 | 9 | 13 | 6 | 5.430610041581775 | 5.385164807134504 | 
| 3:03:00 | 11 | 13 | 12.875 | 8.54400374531753 | 7.724054437220943 | 7.659416862050705 | 
| 3:04:00 | 0 | 10 | 2.5 | 0 | 10.084389681792215 | 10 | 
| 3:05:00 | None | 0 | 0 | None | 0 | 0 | 

## Use temporal functions in transforms


In [transforms](transforms.md) only, you can use the `pretrigger()` function to retrieve the `GOOD` quality value for a variable prior to the property update that initiated the current transform calculation.

Consider an example where a manufacturer uses AWS IoT SiteWise to monitor the status of a machine. The manufacturer uses the following measurements and transforms to represent the process:
+ A measurement, `current_state`, that can be 0 or 1.
  + If the machine is in the cleaning state, `current_state` equals 1.
  + If the machine is in the manufacturing state, `current_state` equals 0.
+ A transform, `cleaning_state_duration`, that equals `if(pretrigger(current_state) == 1, timestamp(current_state) - timestamp(pretrigger(current_state)), none)`. This transform returns how long the machine has been in the cleaning state in seconds, in the Unix epoch format. For more information, see [Use conditional functions in formula expressions](expression-conditional-functions.md) and the [timestamp()](expression-date-and-time-functions.md) function.

If the machine stays in the cleaning state longer than expected, the manufacturer might investigate the machine.

You can also use the `pretrigger()` function in multivariate transforms. For example, you have two measurements named `x` and `y`, and a transform, `z`, that equals `x + y + pretrigger(y)`. The following table shows the values for `x`, `y`, and `z` from 9:00 AM to 9:15 AM.

**Note**  
This example assumes that the values for the measurements arrive chronologically. For example, the value of `x` for 09:00 AM arrives before the value of `x` for 09:05 AM.
If the data points for 9:05 AM arrive before the data points for 9:00 AM, `z` isn't calculated at 9:05 AM.
If the value of `x` for 9:05 AM arrives before the value of `x` for 09:00 AM and the values of `y` arrive chronologically, `z` equals `22 = 20 + 1 + 1` at 9:05 AM.


|  | 09:00 AM | 09:05 AM | 09:10 AM | 09:15 AM | 
| --- | --- | --- | --- | --- | 
|  `x`  |  10  |  20  |    |  30  | 
|  `y`  |  1  |  2  |  3  |    | 
|  `z = x + y + pretrigger(y)`  |  `y` doesn't receive any data point before 09:00 AM. Therefore, `z` isn't calculated at 09:00 AM.  |  23 = 20 \$1 2 \$1 1 `pretrigger(y)` equals 1.  |  25 = 20 \$1 3 \$1 2 `x` doesn't receive a new data point. `pretrigger(y)` equals 2.  |  36 = 30 \$1 3 \$1 3 `y` doesn't receive a new data point. Therefore, `pretrigger(y)` equals 3 at 09:15 AM.  | 

# Use date and time functions in formula expressions
Use date and time functions

In [transforms](transforms.md) and [metrics](metrics.md), you can use the date and time functions in the following ways:
+ Retrieve the current timestamp of a data point in UTC or in the local time zone.
+ Construct timestamps with arguments, such as `year`, `month`, and `day_of_month`.
+ Extract a time period such as a year or month with the `unix_time` argument.


| Function | Description | 
| --- | --- | 
|  `now()`  |  Returns the current date and time, in seconds, in the Unix epoch format.  | 
|  `timestamp()`  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/expression-date-and-time-functions.html)  | 
|  `mktime(time_zone, year, month, day_of_month, hour, minute, second)`  |  Returns the input time in seconds, in the Unix epoch format. The following requirements apply for using this function: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/expression-date-and-time-functions.html) The following limits apply for using this function: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/expression-date-and-time-functions.html) Examples: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/expression-date-and-time-functions.html)  | 
|  `localtime(unix_time, time_zone)`  |  Returns the year, the day of the month, the day of the week, the day of the year, the hour, the minute, or the second in the specified time zone from the Unix time. The following requirements apply for using this function: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/expression-date-and-time-functions.html) Example response: `2007-12-03T10:15:30+01:00[Europe/Paris]` `localtime(unix_time, time_zone)` isn't a standalone function. The `year()`, `mon()`, `mday`, `wday()`, `yday()`, `hour()`, `minute()`, and `sec()` functions take `localtime(unix_time, time_zone)` as an argument. Examples: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/iot-sitewise/latest/userguide/expression-date-and-time-functions.html)  | 
|  `year(localtime(unix_time, time_zone)`  |  Returns the year from `localtime(unix_time, time_zone)`.  | 
|  `mon(localtime(unix_time, time_zone))`  |  Returns the month from `localtime(unix_time, time_zone)`.  | 
|  `mday(localtime(unix_time, time_zone))`  |  Returns the day of the month from `localtime(unix_time, time_zone)`.  | 
|  `wday(localtime(unix_time, time_zone))`  |  Returns the day of the week from `localtime(unix_time, time_zone)`.  | 
|  `yday(localtime(unix_time, time_zone))`  |  Returns the day of the year from `localtime(unix_time, time_zone)`.  | 
|  `hour(localtime(unix_time, time_zone))`  |  Returns the hour from `localtime(unix_time, time_zone)`.  | 
|  `minute(localtime(unix_time, time_zone))`  |  Returns the minute from `localtime(unix_time, time_zone)`.  | 
|  `sec(localtime(unix_time, time_zone))`  |  Returns the second from `localtime(unix_time, time_zone)`.  | 

## Supported time zone formats


You can specify the time zone argument in the following ways:
+ Time zone offset - Specify `'Z'` for UTC or an offset (`'+2'` or `'-5'`).
+ Offset IDs - Combine a time zone abbreviation and an offset. For example, `'GMT+2'` and `'UTC-01:00'`. The time zone abbreviation must contain only three letters.
+ Region based IDs - For example, `'Etc/GMT+12'` and `'Pacific/Pago_Pago'`.

### Supported time zone abbreviations


The date and time functions support the following three-letter time zone abbreviations: 
+ EST - -05:00
+ HST - -10:00
+ MST - -07:00
+ ACT - Australia/Darwin
+ AET - Australia/Sydney
+ AGT - America/Argentina/Buenos\$1Aires
+ ART - Africa/Cairo
+ AST - America/Anchorage
+ BET - America/Sao\$1Paulo
+ BST - Asia/Dhaka
+ CAT - Africa/Harare
+ CET - Europe/Paris
+ CNT - America/St\$1Johns
+ CST - America/Chicago
+ CTT - Asia/Shanghai 
+ EAT - Africa/Addis\$1Ababa
+ IET - America/Indiana/Indianapolis
+ IST - Asia/Kolkata
+ JST - Asia/Tokyo
+ MIT - Pacific/Apia
+ NET - Asia/Yerevan
+ NST - Pacific/Auckland
+ PLT - Asia/Karachi
+ PRT - America/Puerto\$1Rico
+ PST - America/Los\$1Angeles
+ SST - Pacific/Guadalcanal
+ VST - Asia/Ho\$1Chi\$1Minh

### Supported Region-based IDs


The date and time functions support the following Region-based IDs, organized by their relation to UTC\$100:00:
+ Etc/GMT\$112 (UTC-12:00)
+ Pacific/Pago\$1Pago (UTC-11:00)
+ Pacific/Samoa (UTC-11:00)
+ Pacific/Niue (UTC-11:00)
+ US/Samoa (UTC-11:00)
+ Etc/GMT\$111 (UTC-11:00)
+ Pacific/Midway (UTC-11:00)
+ Pacific/Honolulu (UTC-10:00)
+ Pacific/Rarotonga (UTC-10:00)
+ Pacific/Tahiti (UTC-10:00)
+ Pacific/Johnston (UTC-10:00)
+ US/Hawaii (UTC-10:00)
+ SystemV/HST10 (UTC-10:00)
+ Etc/GMT\$110 (UTC-10:00)
+ Pacific/Marquesas (UTC-09:30)
+ Etc/GMT\$19 (UTC-09:00)
+ Pacific/Gambier (UTC-09:00)
+ America/Atka (UTC-09:00)
+ SystemV/YST9 (UTC-09:00)
+ America/Adak (UTC-09:00)
+ US/Aleutian (UTC-09:00)
+ Etc/GMT\$18 (UTC-08:00)
+ US/Alaska (UTC-08:00)
+ America/Juneau (UTC-08:00)
+ America/Metlakatla (UTC-08:00)
+ America/Yakutat (UTC-08:00)
+ Pacific/Pitcairn (UTC-08:00)
+ America/Sitka (UTC-08:00)
+ America/Anchorage (UTC-08:00)
+ SystemV/PST8 (UTC-08:00)
+ America/Nome (UTC-08:00)
+ SystemV/YST9YDT (UTC-08:00)
+ Canada/Yukon (UTC-07:00)
+ US/Pacific-New (UTC-07:00)
+ Etc/GMT\$17 (UTC-07:00)
+ US/Arizona (UTC-07:00)
+ America/Dawson\$1Creek (UTC-07:00)
+ Canada/Pacific (UTC-07:00)
+ PST8PDT (UTC-07:00)
+ SystemV/MST7 (UTC-07:00)
+ America/Dawson (UTC-07:00)
+ Mexico/BajaNorte (UTC-07:00)
+ America/Tijuana (UTC-07:00)
+ America/Creston (UTC-07:00)
+ America/Hermosillo (UTC-07:00)
+ America/Santa\$1Isabel (UTC-07:00)
+ America/Vancouver (UTC-07:00)
+ America/Ensenada (UTC-07:00)
+ America/Phoenix (UTC-07:00)
+ America/Whitehorse (UTC-07:00)
+ America/Fort\$1Nelson (UTC-07:00)
+ SystemV/PST8PDT (UTC-07:00)
+ America/Los\$1Angeles (UTC-07:00)
+ US/Pacific (UTC-07:00)
+ America/El\$1Salvador (UTC-06:00)
+ America/Guatemala (UTC-06:00)
+ America/Belize (UTC-06:00)
+ America/Managua (UTC-06:00)
+ America/Tegucigalpa (UTC-06:00)
+ Etc/GMT\$16 (UTC-06:00)
+ Pacific/Easter (UTC-06:00)
+ Mexico/BajaSur (UTC-06:00)
+ America/Regina (UTC-06:00)
+ America/Denver (UTC-06:00)
+ Pacific/Galapagos (UTC-06:00)
+ America/Yellowknife (UTC-06:00)
+ America/Swift\$1Current (UTC-06:00)
+ America/Inuvik (UTC-06:00)
+ America/Mazatlan (UTC-06:00)
+ America/Boise (UTC-06:00)
+ America/Costa\$1Rica (UTC-06:00)
+ MST7MDT (UTC-06:00)
+ SystemV/CST6 (UTC-06:00)
+ America/Chihuahua (UTC-06:00)
+ America/Ojinaga (UTC-06:00)
+ Chile/EasterIsland (UTC-06:00)
+ US/Mountain (UTC-06:00)
+ America/Edmonton (UTC-06:00)
+ Canada/Mountain (UTC-06:00)
+ America/Cambridge\$1Bay (UTC-06:00)
+ Navajo (UTC-06:00)
+ SystemV/MST7MDT (UTC-06:00)
+ Canada/Saskatchewan (UTC-06:00)
+ America/Shiprock (UTC-06:00)
+ America/Panama (UTC-05:00)
+ America/Chicago (UTC-05:00)
+ America/Eirunepe (UTC-05:00)
+ Etc/GMT\$15 (UTC-05:00)
+ Mexico/General (UTC-05:00)
+ America/Porto\$1Acre (UTC-05:00)
+ America/Guayaquil (UTC-05:00)
+ America/Rankin\$1Inlet (UTC-05:00)
+ US/Central (UTC-05:00)
+ America/Rainy\$1River (UTC-05:00)
+ America/Indiana/Knox (UTC-05:00)
+ America/North\$1Dakota/Beulah (UTC-05:00)
+ America/Monterrey (UTC-05:00)
+ America/Jamaica (UTC-05:00)
+ America/Atikokan (UTC-05:00)
+ America/Coral\$1Harbour (UTC-05:00)
+ America/North\$1Dakota/Center (UTC-05:00)
+ America/Cayman (UTC-05:00)
+ America/Indiana/Tell\$1City (UTC-05:00)
+ America/Mexico\$1City (UTC-05:00)
+ America/Matamoros (UTC-05:00)
+ CST6CDT (UTC-05:00)
+ America/Knox\$1IN (UTC-05:00)
+ America/Bogota (UTC-05:00)
+ America/Menominee (UTC-05:00)
+ America/Resolute (UTC-05:00)
+ SystemV/EST5 (UTC-05:00)
+ Canada/Central (UTC-05:00)
+ Brazil/Acre (UTC-05:00)
+ America/Cancun (UTC-05:00)
+ America/Lima (UTC-05:00)
+ America/Bahia\$1Banderas (UTC-05:00)
+ US/Indiana-Starke (UTC-05:00)
+ America/Rio\$1Branco (UTC-05:00)
+ SystemV/CST6CDT (UTC-05:00)
+ Jamaica (UTC-05:00)
+ America/Merida (UTC-05:00)
+ America/North\$1Dakota/New\$1Salem (UTC-05:00)
+ America/Winnipeg (UTC-05:00)
+ America/Cuiaba (UTC-04:00)
+ America/Marigot (UTC-04:00)
+ America/Indiana/Petersburg (UTC-04:00)
+ Chile/Continental (UTC-04:00)
+ America/Grand\$1Turk (UTC-04:00)
+ Cuba (UTC-04:00)
+ Etc/GMT\$14 (UTC-04:00)
+ America/Manaus (UTC-04:00)
+ America/Fort\$1Wayne (UTC-04:00)
+ America/St\$1Thomas (UTC-04:00)
+ America/Anguilla (UTC-04:00)
+ America/Havana (UTC-04:00)
+ US/Michigan (UTC-04:00)
+ America/Barbados (UTC-04:00)
+ America/Louisville (UTC-04:00)
+ America/Curacao (UTC-04:00)
+ America/Guyana (UTC-04:00)
+ America/Martinique (UTC-04:00)
+ America/Puerto\$1Rico (UTC-04:00)
+ America/Port\$1of\$1Spain (UTC-04:00)
+ SystemV/AST4 (UTC-04:00)
+ America/Indiana/Vevay (UTC-04:00)
+ America/Indiana/Vincennes (UTC-04:00)
+ America/Kralendijk (UTC-04:00)
+ America/Antigua (UTC-04:00)
+ America/Indianapolis (UTC-04:00)
+ America/Iqaluit (UTC-04:00)
+ America/St\$1Vincent (UTC-04:00)
+ America/Kentucky/Louisville (UTC-04:00)
+ America/Dominica (UTC-04:00)
+ America/Asuncion (UTC-04:00)
+ EST5EDT (UTC-04:00)
+ America/Nassau (UTC-04:00)
+ America/Kentucky/Monticello (UTC-04:00)
+ Brazil/West (UTC-04:00)
+ America/Aruba (UTC-04:00)
+ America/Indiana/Indianapolis (UTC-04:00)
+ America/Santiago (UTC-04:00)
+ America/La\$1Paz (UTC-04:00)
+ America/Thunder\$1Bay (UTC-04:00)
+ America/Indiana/Marengo (UTC-04:00)
+ America/Blanc-Sablon (UTC-04:00)
+ America/Santo\$1Domingo (UTC-04:00)
+ US/Eastern (UTC-04:00)
+ Canada/Eastern (UTC-04:00)
+ America/Port-au-Prince (UTC-04:00)
+ America/St\$1Barthelemy (UTC-04:00)
+ America/Nipigon (UTC-04:00)
+ US/East-Indiana (UTC-04:00)
+ America/St\$1Lucia (UTC-04:00)
+ America/Montserrat (UTC-04:00)
+ America/Lower\$1Princes (UTC-04:00)
+ America/Detroit (UTC-04:00)
+ America/Tortola (UTC-04:00)
+ America/Porto\$1Velho (UTC-04:00)
+ America/Campo\$1Grande (UTC-04:00)
+ America/Virgin (UTC-04:00)
+ America/Pangnirtung (UTC-04:00)
+ America/Montreal (UTC-04:00)
+ America/Indiana/Winamac (UTC-04:00)
+ America/Boa\$1Vista (UTC-04:00)
+ America/Grenada (UTC-04:00)
+ America/New\$1York (UTC-04:00)
+ America/St\$1Kitts (UTC-04:00)
+ America/Caracas (UTC-04:00)
+ America/Guadeloupe (UTC-04:00)
+ America/Toronto (UTC-04:00)
+ SystemV/EST5EDT (UTC-04:00)
+ America/Argentina/Catamarca (UTC-03:00)
+ Canada/Atlantic (UTC-03:00)
+ America/Argentina/Cordoba (UTC-03:00)
+ America/Araguaina (UTC-03:00)
+ America/Argentina/Salta (UTC-03:00)
+ Etc/GMT\$13 (UTC-03:00)
+ America/Montevideo (UTC-03:00)
+ Brazil/East (UTC-03:00)
+ America/Argentina/Mendoza (UTC-03:00)
+ America/Argentina/Rio\$1Gallegos (UTC-03:00)
+ America/Catamarca (UTC-03:00)
+ America/Cordoba (UTC-03:00)
+ America/Sao\$1Paulo (UTC-03:00)
+ America/Argentina/Jujuy (UTC-03:00)
+ America/Cayenne (UTC-03:00)
+ America/Recife (UTC-03:00)
+ America/Buenos\$1Aires (UTC-03:00)
+ America/Paramaribo (UTC-03:00)
+ America/Moncton (UTC-03:00)
+ America/Mendoza (UTC-03:00)
+ America/Santarem (UTC-03:00)
+ Atlantic/Bermuda (UTC-03:00)
+ America/Maceio (UTC-03:00)
+ Atlantic/Stanley (UTC-03:00)
+ America/Halifax (UTC-03:00)
+ Antarctica/Rothera (UTC-03:00)
+ America/Argentina/San\$1Luis (UTC-03:00)
+ America/Argentina/Ushuaia (UTC-03:00)
+ Antarctica/Palmer (UTC-03:00)
+ America/Punta\$1Arenas (UTC-03:00)
+ America/Glace\$1Bay (UTC-03:00)
+ America/Fortaleza (UTC-03:00)
+ America/Thule (UTC-03:00)
+ America/Argentina/La\$1Rioja (UTC-03:00)
+ America/Belem (UTC-03:00)
+ America/Jujuy (UTC-03:00)
+ America/Bahia (UTC-03:00)
+ America/Goose\$1Bay (UTC-03:00)
+ America/Argentina/San\$1Juan (UTC-03:00)
+ America/Argentina/ComodRivadavia (UTC-03:00)
+ America/Argentina/Tucuman (UTC-03:00)
+ America/Rosario (UTC-03:00)
+ SystemV/AST4ADT (UTC-03:00)
+ America/Argentina/Buenos\$1Aires (UTC-03:00)
+ America/St\$1Johns (UTC-02:30)
+ Canada/Newfoundland (UTC-02:30)
+ America/Miquelon (UTC-02:00)
+ Etc/GMT\$12 (UTC-02:00)
+ America/Godthab (UTC-02:00)
+ America/Noronha (UTC-02:00)
+ Brazil/DeNoronha (UTC-02:00)
+ Atlantic/South\$1Georgia (UTC-02:00)
+ Etc/GMT\$11 (UTC-01:00)
+ Atlantic/Cape\$1Verde (UTC-01:00)
+ Pacific/Kiritimati (UTC\$114:00)
+ Etc/GMT-14 (UTC\$114:00)
+ Pacific/Fakaofo (UTC\$113:00)
+ Pacific/Enderbury (UTC\$113:00)
+ Pacific/Apia (UTC\$113:00)
+ Pacific/Tongatapu (UTC\$113:00)
+ Etc/GMT-13 (UTC\$113:00)
+ NZ-CHAT (UTC\$112:45)
+ Pacific/Chatham (UTC\$112:45)
+ Pacific/Kwajalein (UTC\$112:00)
+ Antarctica/McMurdo (UTC\$112:00)
+ Pacific/Wallis (UTC\$112:00)
+ Pacific/Fiji (UTC\$112:00)
+ Pacific/Funafuti (UTC\$112:00)
+ Pacific/Nauru (UTC\$112:00)
+ Kwajalein (UTC\$112:00)
+ NZ (UTC\$112:00)
+ Pacific/Wake (UTC\$112:00)
+ Antarctica/South\$1Pole (UTC\$112:00)
+ Pacific/Tarawa (UTC\$112:00)
+ Pacific/Auckland (UTC\$112:00)
+ Asia/Kamchatka (UTC\$112:00)
+ Etc/GMT-12 (UTC\$112:00)
+ Asia/Anadyr (UTC\$112:00)
+ Pacific/Majuro (UTC\$112:00)
+ Pacific/Ponape (UTC\$111:00)
+ Pacific/Bougainville (UTC\$111:00)
+ Antarctica/Macquarie (UTC\$111:00)
+ Pacific/Pohnpei (UTC\$111:00)
+ Pacific/Efate (UTC\$111:00)
+ Pacific/Norfolk (UTC\$111:00)
+ Asia/Magadan (UTC\$111:00)
+ Pacific/Kosrae (UTC\$111:00)
+ Asia/Sakhalin (UTC\$111:00)
+ Pacific/Noumea (UTC\$111:00)
+ Etc/GMT-11 (UTC\$111:00)
+ Asia/Srednekolymsk (UTC\$111:00)
+ Pacific/Guadalcanal (UTC\$111:00)
+ Australia/Lord\$1Howe (UTC\$110:30)
+ Australia/LHI (UTC\$110:30)
+ Australia/Hobart (UTC\$110:00)
+ Pacific/Yap (UTC\$110:00)
+ Australia/Tasmania (UTC\$110:00)
+ Pacific/Port\$1Moresby (UTC\$110:00)
+ Australia/ACT (UTC\$110:00)
+ Australia/Victoria (UTC\$110:00)
+ Pacific/Chuuk (UTC\$110:00)
+ Australia/Queensland (UTC\$110:00)
+ Australia/Canberra (UTC\$110:00)
+ Australia/Currie (UTC\$110:00)
+ Pacific/Guam (UTC\$110:00)
+ Pacific/Truk (UTC\$110:00)
+ Australia/NSW (UTC\$110:00)
+ Asia/Vladivostok (UTC\$110:00)
+ Pacific/Saipan (UTC\$110:00)
+ Antarctica/DumontDUrville (UTC\$110:00)
+ Australia/Sydney (UTC\$110:00)
+ Australia/Brisbane (UTC\$110:00)
+ Etc/GMT-10 (UTC\$110:00)
+ Asia/Ust-Nera (UTC\$110:00)
+ Australia/Melbourne (UTC\$110:00)
+ Australia/Lindeman (UTC\$110:00)
+ Australia/North (UTC\$109:30)
+ Australia/Yancowinna (UTC\$109:30)
+ Australia/Adelaide (UTC\$109:30)
+ Australia/Broken\$1Hill (UTC\$109:30)
+ Australia/South (UTC\$109:30)
+ Australia/Darwin (UTC\$109:30)
+ Etc/GMT-9 (UTC\$109:00)
+ Pacific/Palau (UTC\$109:00)
+ Asia/Chita (UTC\$109:00)
+ Asia/Dili (UTC\$109:00)
+ Asia/Jayapura (UTC\$109:00)
+ Asia/Yakutsk (UTC\$109:00)
+ Asia/Pyongyang (UTC\$109:00)
+ ROK (UTC\$109:00)
+ Asia/Seoul (UTC\$109:00)
+ Asia/Khandyga (UTC\$109:00)
+ Japan (UTC\$109:00)
+ Asia/Tokyo (UTC\$109:00)
+ Australia/Eucla (UTC\$108:45)
+ Asia/Kuching (UTC\$108:00)
+ Asia/Chungking (UTC\$108:00)
+ Etc/GMT-8 (UTC\$108:00)
+ Australia/Perth (UTC\$108:00)
+ Asia/Macao (UTC\$108:00)
+ Asia/Macau (UTC\$108:00)
+ Asia/Choibalsan (UTC\$108:00)
+ Asia/Shanghai (UTC\$108:00)
+ Antarctica/Casey (UTC\$108:00)
+ Asia/Ulan\$1Bator (UTC\$108:00)
+ Asia/Chongqing (UTC\$108:00)
+ Asia/Ulaanbaatar (UTC\$108:00)
+ Asia/Taipei (UTC\$108:00)
+ Asia/Manila (UTC\$108:00)
+ PRC (UTC\$108:00)
+ Asia/Ujung\$1Pandang (UTC\$108:00)
+ Asia/Harbin (UTC\$108:00)
+ Singapore (UTC\$108:00)
+ Asia/Brunei (UTC\$108:00)
+ Australia/West (UTC\$108:00)
+ Asia/Hong\$1Kong (UTC\$108:00)
+ Asia/Makassar (UTC\$108:00)
+ Hongkong (UTC\$108:00)
+ Asia/Kuala\$1Lumpur (UTC\$108:00)
+ Asia/Irkutsk (UTC\$108:00)
+ Asia/Singapore (UTC\$108:00)
+ Asia/Pontianak (UTC\$107:00)
+ Etc/GMT-7 (UTC\$107:00)
+ Asia/Phnom\$1Penh (UTC\$107:00)
+ Asia/Novosibirsk (UTC\$107:00)
+ Antarctica/Davis (UTC\$107:00)
+ Asia/Tomsk (UTC\$107:00)
+ Asia/Jakarta (UTC\$107:00)
+ Asia/Barnaul (UTC\$107:00)
+ Indian/Christmas (UTC\$107:00)
+ Asia/Ho\$1Chi\$1Minh (UTC\$107:00)
+ Asia/Hovd (UTC\$107:00)
+ Asia/Bangkok (UTC\$107:00)
+ Asia/Vientiane (UTC\$107:00)
+ Asia/Novokuznetsk (UTC\$107:00)
+ Asia/Krasnoyarsk (UTC\$107:00)
+ Asia/Saigon (UTC\$107:00)
+ Asia/Yangon (UTC\$106:30)
+ Asia/Rangoon (UTC\$106:30)
+ Indian/Cocos (UTC\$106:30)
+ Asia/Kashgar (UTC\$106:00)
+ Etc/GMT-6 (UTC\$106:00)
+ Asia/Almaty (UTC\$106:00)
+ Asia/Dacca (UTC\$106:00)
+ Asia/Omsk (UTC\$106:00)
+ Asia/Dhaka (UTC\$106:00)
+ Indian/Chagos (UTC\$106:00)
+ Asia/Qyzylorda (UTC\$106:00)
+ Asia/Bishkek (UTC\$106:00)
+ Antarctica/Vostok (UTC\$106:00)
+ Asia/Urumqi (UTC\$106:00)
+ Asia/Thimbu (UTC\$106:00)
+ Asia/Thimphu (UTC\$106:00)
+ Asia/Kathmandu (UTC\$105:45)
+ Asia/Katmandu (UTC\$105:45)
+ Asia/Kolkata (UTC\$105:30)
+ Asia/Colombo (UTC\$105:30)
+ Asia/Calcutta (UTC\$105:30)
+ Asia/Aqtau (UTC\$105:00)
+ Etc/GMT-5 (UTC\$105:00)
+ Asia/Samarkand (UTC\$105:00)
+ Asia/Karachi (UTC\$105:00)
+ Asia/Yekaterinburg (UTC\$105:00)
+ Asia/Dushanbe (UTC\$105:00)
+ Indian/Maldives (UTC\$105:00)
+ Asia/Oral (UTC\$105:00)
+ Asia/Tashkent (UTC\$105:00)
+ Antarctica/Mawson (UTC\$105:00)
+ Asia/Aqtobe (UTC\$105:00)
+ Asia/Ashkhabad (UTC\$105:00)
+ Asia/Ashgabat (UTC\$105:00)
+ Asia/Atyrau (UTC\$105:00)
+ Indian/Kerguelen (UTC\$105:00)
+ Iran (UTC\$104:30)
+ Asia/Tehran (UTC\$104:30)
+ Asia/Kabul (UTC\$104:30)
+ Asia/Yerevan (UTC\$104:00)
+ Etc/GMT-4 (UTC\$104:00)
+ Etc/GMT-4 (UTC\$104:00)
+ Asia/Dubai (UTC\$104:00)
+ Indian/Reunion (UTC\$104:00)
+ Europe/Saratov (UTC\$104:00)
+ Europe/Samara (UTC\$104:00)
+ Indian/Mahe (UTC\$104:00)
+ Asia/Baku (UTC\$104:00)
+ Asia/Muscat (UTC\$104:00)
+ Europe/Volgograd (UTC\$104:00)
+ Europe/Astrakhan (UTC\$104:00)
+ Asia/Tbilisi (UTC\$104:00)
+ Europe/Ulyanovsk (UTC\$104:00)
+ Asia/Aden (UTC\$103:00)
+ Africa/Nairobi (UTC\$103:00)
+ Europe/Istanbul (UTC\$103:00)
+ Etc/GMT-3 (UTC\$103:00)
+ Europe/Zaporozhye (UTC\$103:00)
+ Israel (UTC\$103:00)
+ Indian/Comoro (UTC\$103:00)
+ Antarctica/Syowa (UTC\$103:00)
+ Africa/Mogadishu (UTC\$103:00)
+ Europe/Bucharest (UTC\$103:00)
+ Africa/Asmera (UTC\$103:00)
+ Europe/Mariehamn (UTC\$103:00)
+ Asia/Istanbul (UTC\$103:00)
+ Europe/Tiraspol (UTC\$103:00)
+ Europe/Moscow (UTC\$103:00)
+ Europe/Chisinau (UTC\$103:00)
+ Europe/Helsinki (UTC\$103:00)
+ Asia/Beirut (UTC\$103:00)
+ Asia/Tel\$1Aviv (UTC\$103:00)
+ Africa/Djibouti (UTC\$103:00)
+ Europe/Simferopol (UTC\$103:00)
+ Europe/Sofia (UTC\$103:00)
+ Asia/Gaza (UTC\$103:00)
+ Africa/Asmara (UTC\$103:00)
+ Europe/Riga (UTC\$103:00)
+ Asia/Baghdad (UTC\$103:00)
+ Asia/Damascus (UTC\$103:00)
+ Africa/Dar\$1es\$1Salaam (UTC\$103:00)
+ Africa/Addis\$1Ababa (UTC\$103:00)
+ Europe/Uzhgorod (UTC\$103:00)
+ Asia/Jerusalem (UTC\$103:00)
+ Asia/Riyadh (UTC\$103:00)
+ Asia/Kuwait (UTC\$103:00)
+ Europe/Kirov (UTC\$103:00)
+ Africa/Kampala (UTC\$103:00)
+ Europe/Minsk (UTC\$103:00)
+ Asia/Qatar (UTC\$103:00)
+ Europe/Kiev (UTC\$103:00)
+ Asia/Bahrain (UTC\$103:00)
+ Europe/Vilnius (UTC\$103:00)
+ Indian/Antananarivo (UTC\$103:00)
+ Indian/Mayotte (UTC\$103:00)
+ Europe/Tallinn (UTC\$103:00)
+ Turkey (UTC\$103:00)
+ Africa/Juba (UTC\$103:00)
+ Asia/Nicosia (UTC\$103:00)
+ Asia/Famagusta (UTC\$103:00)
+ W-SU (UTC\$103:00)
+ EET (UTC\$103:00)
+ Asia/Hebron (UTC\$103:00)
+ Asia/Amman (UTC\$103:00)
+ Europe/Nicosia (UTC\$103:00)
+ Europe/Athens (UTC\$103:00)
+ Africa/Cairo (UTC\$102:00)
+ Africa/Mbabane (UTC\$102:00)
+ Europe/Brussels (UTC\$102:00)
+ Europe/Warsaw (UTC\$102:00)
+ CET (UTC\$102:00)
+ Europe/Luxembourg (UTC\$102:00)
+ Etc/GMT-2 (UTC\$102:00)
+ Libya (UTC\$102:00)
+ Africa/Kigali (UTC\$102:00)
+ Africa/Tripoli (UTC\$102:00)
+ Europe/Kaliningrad (UTC\$102:00)
+ Africa/Windhoek (UTC\$102:00)
+ Europe/Malta (UTC\$102:00)
+ Europe/Busingen (UTC\$102:00)
+ 
+ Europe/Skopje (UTC\$102:00)
+ Europe/Sarajevo (UTC\$102:00)
+ Europe/Rome (UTC\$102:00)
+ Europe/Zurich (UTC\$102:00)
+ Europe/Gibraltar (UTC\$102:00)
+ Africa/Lubumbashi (UTC\$102:00)
+ Europe/Vaduz (UTC\$102:00)
+ Europe/Ljubljana (UTC\$102:00)
+ Europe/Berlin (UTC\$102:00)
+ Europe/Stockholm (UTC\$102:00)
+ Europe/Budapest (UTC\$102:00)
+ Europe/Zagreb (UTC\$102:00)
+ Europe/Paris (UTC\$102:00)
+ Africa/Ceuta (UTC\$102:00)
+ Europe/Prague (UTC\$102:00)
+ Antarctica/Troll (UTC\$102:00)
+ Africa/Gaborone (UTC\$102:00)
+ Europe/Copenhagen (UTC\$102:00)
+ Europe/Vienna (UTC\$102:00)
+ Europe/Tirane (UTC\$102:00)
+ MET (UTC\$102:00)
+ Europe/Amsterdam (UTC\$102:00)
+ Africa/Maputo (UTC\$102:00)
+ Europe/San\$1Marino (UTC\$102:00)
+ Poland (UTC\$102:00)
+ Europe/Andorra (UTC\$102:00)
+ Europe/Oslo (UTC\$102:00)
+ Europe/Podgorica (UTC\$102:00)
+ Africa/Bujumbura (UTC\$102:00)
+ Atlantic/Jan\$1Mayen (UTC\$102:00)
+ Africa/Maseru (UTC\$102:00)
+ Europe/Madrid (UTC\$102:00)
+ Africa/Blantyre (UTC\$102:00)
+ Africa/Lusaka (UTC\$102:00)
+ Africa/Harare (UTC\$102:00)
+ Africa/Khartoum (UTC\$102:00)
+ Africa/Johannesburg (UTC\$102:00)
+ Europe/Belgrade (UTC\$102:00)
+ Europe/Bratislava (UTC\$102:00)
+ Arctic/Longyearbyen (UTC\$102:00)
+ Egypt (UTC\$102:00)
+ Europe/Vatican (UTC\$102:00)
+ Europe/Monaco (UTC\$102:00)
+ Europe/London (UTC\$101:00)
+ Etc/GMT-1 (UTC\$101:00)
+ Europe/Jersey (UTC\$101:00)
+ Europe/Guernsey (UTC\$101:00)
+ Europe/Isle\$1of\$1Man (UTC\$101:00)
+ Africa/Tunis (UTC\$101:00)
+ Africa/Malabo (UTC\$101:00)
+ GB-Eire (UTC\$101:00)
+ Africa/Lagos (UTC\$101:00)
+ Africa/Algiers (UTC\$101:00)
+ GB (UTC\$101:00)
+ Portugal (UTC\$101:00)
+ Africa/Sao\$1Tome (UTC\$101:00)
+ Africa/Ndjamena (UTC\$101:00)
+ Atlantic/Faeroe (UTC\$101:00)
+ Eire (UTC\$101:00)
+ Atlantic/Faroe (UTC\$101:00)
+ Europe/Dublin (UTC\$101:00)
+ Africa/Libreville (UTC\$101:00)
+ Africa/El\$1Aaiun (UTC\$101:00)
+ Africa/El\$1Aaiun (UTC\$101:00)
+ Africa/Douala (UTC\$101:00)
+ Africa/Brazzaville (UTC\$101:00)
+ Africa/Porto-Novo (UTC\$101:00)
+ Atlantic/Madeira (UTC\$101:00)
+ Europe/Lisbon (UTC\$101:00)
+ Atlantic/Canary (UTC\$101:00)
+ Africa/Casablanca (UTC\$101:00)
+ Europe/Belfast (UTC\$101:00)
+ Africa/Luanda (UTC\$101:00)
+ Africa/Kinshasa (UTC\$101:00)
+ Africa/Bangui (UTC\$101:00)
+ WET (UTC\$101:00)
+ Africa/Niamey (UTC\$101:00)
+ GMT (UTC\$100:00)
+ Etc/GMT-0 (UTC\$100:00)
+ Atlantic/St\$1Helena (UTC\$100:00)
+ Etc/GMT\$10 (UTC\$100:00)
+ Africa/Banjul (UTC\$100:00)
+ Etc/GMT (UTC\$100:00)
+ Africa/Freetown (UTC\$100:00)
+ Africa/Bamako (UTC\$100:00)
+ Africa/Conakry (UTC\$100:00)
+ Universal (UTC\$100:00)
+ Africa/Nouakchott (UTC\$100:00)
+ UTC (UTC\$100:00)
+ Etc/Universal (UTC\$100:00)
+ Atlantic/Azores (UTC\$100:00)
+ Africa/Abidjan (UTC\$100:00)
+ Africa/Accra (UTC\$100:00)
+ Etc/UCT (UTC\$100:00)
+ GMT0 (UTC\$100:00)
+ Zulu (UTC\$100:00)Zulu (UTC\$100:00)
+ Africa/Ouagadougou (UTC\$100:00)
+ Atlantic/Reykjavik (UTC\$100:00)
+ Etc/Zulu (UTC\$100:00)
+ Iceland (UTC\$100:00)
+ Africa/Lome (UTC\$100:00)
+ Greenwich (UTC\$100:00)
+ Etc/GMT0 (UTC\$100:00)
+ America/Danmarkshavn (UTC\$100:00)
+ Africa/Dakar (UTC\$100:00)
+ Africa/Bissau (UTC\$100:00)
+ Etc/Greenwich (UTC\$100:00)
+ Africa/Timbuktu (UTC\$100:00)
+ UCT (UTC\$100:00)
+ Africa/Monrovia (UTC\$100:00)
+ Etc/UTC (UTC\$100:00)

# Formula expression tutorials


You can follow these tutorials to use formula expressions in AWS IoT SiteWise.

**Topics**
+ [

## Use strings in formulas
](#use-strings-in-formulas)
+ [

## Filter data points
](#filter-data)
+ [

## Count data points that match a condition
](#count-filtered-data)
+ [

## Late data in formulas
](#late-data)
+ [

## Data quality in formulas
](#data-quality)
+ [

## Undefined, infinite, and overflow values
](#undefined-values)

## Use strings in formulas


You can operate on strings in your formula expressions. You also can input strings from variables that reference attribute and measurement properties.

**Important**  
<a name="formula-output-rules"></a>Formula expressions can only output double or string values. Nested expressions can output other data types, such as strings, but the formula as a whole must evaluate to a number or string. You can use the [jp function](expression-string-functions.md#jp-definition) to convert a string to a number. The Boolean value must be 1 (true) or 0 (false). For more information, see [Undefined, infinite, and overflow values](#undefined-values).

AWS IoT SiteWise provides the following formula expression features that you can use to operate on strings:
+ [String literals](expression-literals.md#string-literal-definition)
+ The [index operator](expression-operators.md#index-operator-definition) (`s[index]`)
+ The [slice operator](expression-operators.md#slice-operator-definition) (`s[start:end:step]`)
+ [Comparison functions](expression-comparison-functions.md), which you can use compare strings by [lexicographic order](https://en.wikipedia.org/wiki/Lexicographic_order)
+ [String functions](expression-string-functions.md), which include the `jp` function that can parse serialized JSON objects and convert strings to numbers

## Filter data points


You can use the [if function](expression-conditional-functions.md#if-definition) to filter out data points that don't meet a condition. The `if` function evaluates a condition and returns different values for `true` and `false` results. You can use the [none constant](expression-constants.md#none-definition) as an output for one case of an `if` function to discard the data point for that case.

**To filter out data points that match a condition**
+ Create a transform that uses the `if` function to define a condition that checks if a condition is met, and returns `none` as either the `result_if_true` or `result_if_false` value.

**Example: Filter out data points where water isn't boiling**  
Consider a scenario where you have a measurement, `temp_c`, that provides the temperature (in Celsius) of water in a machine. You can define the following transform to filter out data points where the water isn't boiling:  
+ Transform: `boiling_temps = if(gte(temp_c, 100), temp_c, none)` – Returns the temperature if it's greater than or equal to 100 degrees Celsius, otherwise returns no data point.

## Count data points that match a condition


You can use [comparison functions](expression-comparison-functions.md) and [sum()](expression-aggregation-functions.md#sum-definition) to count the number of data points for which a condition is true.

**To count data points that match a condition**

1. Create a transform that uses a comparison function to define a filter condition on another property.

1. Create a metric that sums the data points where that condition is met.

**Example: Count the number of data points where water is boiling**  
Consider a scenario where you have a measurement, `temp_c`, that provides the temperature (in Celsius) of water in a machine. You can define the following transform and metric properties to count the number of data points where the water is boiling:  
+ Transform: `is_boiling = gte(temp_c, 100)` – Returns `1` if the temperature is greater than or equal to 100 degrees Celsius, otherwise returns `0`.
+ Metric: `boiling_count = sum(is_boiling)` – Returns the number of data points where water is boiling.

## Late data in formulas


AWS IoT SiteWise supports late data ingestion of data that is up to 7 days old. When AWS IoT SiteWise receives late data, it recalculates existing values for any metric that inputs the late data in a past window. These recalculations result in data processing charges.

**Note**  
When AWS IoT SiteWise computes properties that input late data, it uses each property's current formula expression.

After AWS IoT SiteWise recalculates a past window for a metric, it replaces the previous value for that window. If you enabled notifications for that metric, AWS IoT SiteWise also emits a property value notification. This means that you can receive a new property value update notification for the same property and timestamp for which you previously received a notification. If your applications or data lakes consume property value notifications, you must update the previous value with the new value so that their data is accurate.

## Data quality in formulas


In AWS IoT SiteWise, each data point has a quality code, which can be one of the following:
+ `GOOD` – The data isn't affected by any issues.
+ `BAD` – The data is affected by an issue such as sensor failure.
+ `UNCERTAIN` – The data is affected by an issue such as sensor inaccuracy.

AWS IoT SiteWise consumes only `GOOD` quality data when it computes transforms and metrics. AWS IoT SiteWise outputs only `GOOD` quality data for successful computations. If a computation is unsuccessful, then AWS IoT SiteWise doesn't output a data point for that computation. This can occur if a computation results in an undefined, infinite, or overflow value.

For more information about how to query data and filter by data quality, see [Query data from AWS IoT SiteWise](query-industrial-data.md).

## Undefined, infinite, and overflow values


Some formula expressions (such as `x / 0`, `sqrt(-1)`, or `log(0)`) calculate values that are undefined in a real number system, infinite, or outside the range supported by AWS IoT SiteWise. When an asset property's expression computes an undefined, infinite, or overflow value, AWS IoT SiteWise doesn't output a data point for that computation.

AWS IoT SiteWise also doesn't output a data point if it computes a non-numeric value as the result of a formula expression. This means that if you define a formula that computes a string, array, or the [none constant](expression-constants.md#none-definition), then AWS IoT SiteWise doesn't output a data point for that computation.

**Examples**  
Each of the following formula expressions result in a value that AWS IoT SiteWise can't represent as a number. AWS IoT SiteWise doesn't output a data point when it computes these formula expressions.  
+ `x / 0` is undefined.
+ `log(0)` is undefined.
+ `sqrt(-1)` is undefined in a real number system.
+ `"hello" + " world"` is a string.
+ `jp('{"values":[3,6,7]}', '$.values')` is an array.
+ `if(gte(temp, 300), temp, none)` is `none` when `temp` is less than `300`.