Using 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. For more information about how to define asset properties that use formula expressions, see Transforming data (transforms) and Aggregating data from properties and other assets (metrics). Transforms and metrics are formula properties.
Contents
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), raw data streams (measurements), 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 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 and Defining metrics.
Literals
You can define number and string literals in formula expressions.
-
Numbers
Use numbers and scientific notation to define integers and doubles. You can use E notation
to express numbers with scientific notation. Examples:
1
,2.0
,.9
,-23.1
,7.89e3
,3.4E-5
-
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""}"
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 |
|
Subtracts the right operand from the left operand. You can only use this operator with numeric operands. |
|
Divides the left operand by the right operand. You can only use this operator with numeric operands. |
|
Multiplies the left and right operands. You can only use this operator with numeric operands. |
|
Raises the left operand to the power of the right operand (exponentiation). 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. You can only use this operator with numeric operands. |
|
Returns the character at an index Examples
|
|
Returns a slice of the string
You can omit the The arguments must be integers or the none constant. If you specify Examples
|
Constants
You can use the following common mathematical constants in your expressions. All constants are case insensitive.
If you define a variable with the same name as a constant, the variable overrides the constant.
Constant | Description |
---|---|
|
The number pi ( |
|
The number e: |
|
Equivalent to the number 1. In AWS IoT SiteWise, Booleans convert to their number equivalents. |
|
Equivalent to the number 0. In AWS IoT SiteWise, Booleans convert to their number equivalents. |
|
Equivalent to no value. You can use this constant to output nothing as the result of a conditional expression. |
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.
Function type | Transforms | Metrics |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
. For example, functions with the regular syntax might look likefunction_name
(argument1, argument2, argument3, ...
)log(x)
andcontains(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.
. For example, functions with UFCS might look likeargument1
.function_name
(argument2
,argument3
, ...)x.log()
ands.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 ofcontains(lower(jp(message, '$.status')),'fail')
.For more information, visit the D Programming Language
website.
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.
Common functions
In transforms and metrics, you can use the following functions to calculate common mathematical functions in transforms and metrics.
Function | Description |
---|---|
|
Returns the absolute value of |
|
Returns the arccosine of |
|
Returns the arcsine of |
|
Returns the arctangent of |
|
Returns the cubic root of |
|
Returns the nearest integer greater than |
|
Returns the cosine of |
|
Returns the hyperbolic cosine of |
|
Returns the cotangent of |
|
Returns |
|
Returns |
|
Returns the nearest integer less than |
|
Returns the |
|
Returns the |
|
Returns |
|
Returns the |
|
Returns |
|
Returns the sign of |
|
Returns the sine of |
|
Returns the hyperbolic sine of |
|
Returns the square root of |
|
Returns the tangent of |
|
Returns the hyperbolic tangent of |
Comparison functions
In transforms and metrics, 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
Function | Description |
---|---|
|
Returns This function doesn't return a value if
|
|
Returns AWS IoT SiteWise considers the arguments equal if they are
within a relative tolerance of This function doesn't return a value if
|
|
Returns AWS IoT SiteWise considers the arguments equal if they are
within a relative tolerance of |
|
Returns This function doesn't return a value if
|
|
Returns AWS IoT SiteWise considers the arguments equal if they are
within a relative tolerance of This function doesn't return a value if
|
|
Returns This function doesn't return a value if |
Conditional functions
In transforms and metrics, you can use the following function to check a condition and return different results whether the condition evaluates to true or false.
Function | Description |
---|---|
|
Evaluates the
You can return the none constant 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 Filtering data points. Examples
We recommend that you use UFCS for nested conditional functions
where one or more arguments are conditional functions. You can use For example, you can use You must use |
String functions
In transforms and metrics, you can use the following functions to operate on strings. For more information, see Using strings in formulas.
Formula expressions can only output double values. Nested expressions can output other data types, such as strings, but the formula as a whole must evaluate to a number. You can use the jp function to convert a string to a number. If you define a formula that computes a non-numeric value, AWS IoT SiteWise doesn't output a data point for that computation. For more information, see Undefined, infinite, and overflow values.
Function | Description |
---|---|
|
Returns the length of the string |
|
Returns the index of the string |
|
Returns |
|
Returns the string |
|
Returns the string |
|
Evaluates the string Use this function to do the following:
To extract a string value from a JSON structure and return it as a
number, you must use multiple nested The string Examples
|
Aggregation functions
In metrics 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, number literals,
temporal functions, or
aggregation functions. This means that you can't provide nested expressions as
arguments to aggregation functions. For example, the formula avg(x + 1)
isn't valid. By contrast, the formula max(latest(x), latest(y),
latest(z))
is valid and returns the largest current value of the
x
, y
, and z
properties.
AWS IoT SiteWise also automatically computes aggregates over certain time intervals for all properties. For more information, see Querying asset property aggregates.
Function | Description |
---|---|
|
Returns the mean 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. |
|
Returns the sum 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. |
|
Returns the minimum 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. |
|
Returns the maximum 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. |
|
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 Counting data points that match a condition. This function computes a data point for every time interval. |
Temporal functions
In metrics 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. This means that you can't use properties from child asset models in temporal functions. You also can't use expressions as arguments to temporal functions.
Function | Description |
---|---|
|
Returns the given variable's value with the earliest timestamp over the current time interval. |
|
Returns the given variable's value with the latest timestamp over the current time interval. |
|
Returns the given variable's value with the latest timestamp before 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. |
|
Returns the given variable's 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. |
|
Returns the amount of time in seconds that the given variables are
positive over the current time interval. You can use the comparison functions to
create a transform property for the For example, if you have an 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. |
The following diagram shows how AWS IoT SiteWise computes the temporal functions
first
, last
, earliest
, and
latest
, relative to the current time interval.

Consider an example where you have an asset with the following properties:
-
Idle
– A measurement that is0
or1
. When the value is1
, the machine is idle. -
Idle Time
– A metric that uses the formulastatetime(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
is0
). -
At 2:00:30 PM, the machine is idle (
Idle
is1
). -
Idle
doesn't change again before the end of the interval at 2:01:00 PM, soIdle 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, soIdle 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, soIdle 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, soIdle Time
is 0 seconds.
-
Date and time functions
In transforms and metrics, 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
, andday_of_month
. -
Extract a time period such as a year or month with the
unix_time
argument.
Function | Description |
---|---|
|
Returns the current date and time, in seconds, in the Unix epoch format. |
|
|
|
Returns the input time in seconds, in the Unix epoch format. The following requirements apply, when you use the function:
The following limits apply, when you use the function:
Examples:
|
|
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, when you use the function:
Example response:
Examples:
|
|
Returns the year from |
|
Returns the month from |
|
Returns the day of the month from |
|
Returns the day of the week from |
|
Returns the day of the year from |
|
Returns the hour from |
|
Returns the minute from |
|
Returns the second from |
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. For a list of supported time zone abbreviations, see Supported time zone abbreviations and region based IDs:. -
Region based IDs - For example,
'Etc/GMT+12'
and'Pacific/Pago_Pago'
. For the list of supported region based IDs, see Supported time zone abbreviations and region based IDs:.
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_Aires
-
ART - Africa/Cairo
-
AST - America/Anchorage
-
BET - America/Sao_Paulo
-
BST - Asia/Dhaka
-
CAT - Africa/Harare
-
CNT - America/St_Johns
-
CST - America/Chicago
-
CTT - Asia/Shanghai
-
EAT - Africa/Addis_Ababa
-
CET - Europe/Paris
-
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_Rico
-
PST - America/Los_Angeles
-
SST - Pacific/Guadalcanal
-
VST - Asia/Ho_Chi_Minh
The date and time functions support the following region based IDs:
-
Etc/GMT+12 (UTC-12:00)
-
Pacific/Pago_Pago (UTC-11:00)
-
Pacific/Samoa (UTC-11:00)
-
Pacific/Niue (UTC-11:00)
-
US/Samoa (UTC-11:00)
-
Etc/GMT+11 (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+10 (UTC-10:00)
-
Pacific/Marquesas (UTC-09:30)
-
Etc/GMT+9 (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+8 (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+7 (UTC-07:00)
-
US/Arizona (UTC-07:00)
-
America/Dawson_Creek (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_Isabel (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_Nelson (UTC-07:00)
-
SystemV/PST8PDT (UTC-07:00)
-
America/Los_Angeles (UTC-07:00)
-
US/Pacific (UTC-07:00)
-
America/El_Salvador (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+6 (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_Current (UTC-06:00)
-
America/Inuvik (UTC-06:00)
-
America/Mazatlan (UTC-06:00)
-
America/Boise (UTC-06:00)
-
America/Costa_Rica (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_Bay (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+5 (UTC-05:00)
-
Mexico/General (UTC-05:00)
-
America/Porto_Acre (UTC-05:00)
-
America/Guayaquil (UTC-05:00)
-
America/Rankin_Inlet (UTC-05:00)
-
US/Central (UTC-05:00)
-
America/Rainy_River (UTC-05:00)
-
America/Indiana/Knox (UTC-05:00)
-
America/North_Dakota/Beulah (UTC-05:00)
-
America/Monterrey (UTC-05:00)
-
America/Jamaica (UTC-05:00)
-
America/Atikokan (UTC-05:00)
-
America/Coral_Harbour (UTC-05:00)
-
America/North_Dakota/Center (UTC-05:00)
-
America/Cayman (UTC-05:00)
-
America/Indiana/Tell_City (UTC-05:00)
-
America/Mexico_City (UTC-05:00)
-
America/Matamoros (UTC-05:00)
-
CST6CDT (UTC-05:00)
-
America/Knox_IN (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_Banderas (UTC-05:00)
-
US/Indiana-Starke (UTC-05:00)
-
America/Rio_Branco (UTC-05:00)
-
SystemV/CST6CDT (UTC-05:00)
-
Jamaica (UTC-05:00)
-
America/Merida (UTC-05:00)
-
America/North_Dakota/New_Salem (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_Turk (UTC-04:00)
-
Cuba (UTC-04:00)
-
Etc/GMT+4 (UTC-04:00)
-
America/Manaus (UTC-04:00)
-
America/Fort_Wayne (UTC-04:00)
-
America/St_Thomas (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_Rico (UTC-04:00)
-
America/Port_of_Spain (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_Vincent (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_Paz (UTC-04:00)
-
America/Thunder_Bay (UTC-04:00)
-
America/Indiana/Marengo (UTC-04:00)
-
America/Blanc-Sablon (UTC-04:00)
-
America/Santo_Domingo (UTC-04:00)
-
US/Eastern (UTC-04:00)
-
Canada/Eastern (UTC-04:00)
-
America/Port-au-Prince (UTC-04:00)
-
America/St_Barthelemy (UTC-04:00)
-
America/Nipigon (UTC-04:00)
-
US/East-Indiana (UTC-04:00)
-
America/St_Lucia (UTC-04:00)
-
America/Montserrat (UTC-04:00)
-
America/Lower_Princes (UTC-04:00)
-
America/Detroit (UTC-04:00)
-
America/Tortola (UTC-04:00)
-
America/Porto_Velho (UTC-04:00)
-
America/Campo_Grande (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_Vista (UTC-04:00)
-
America/Grenada (UTC-04:00)
-
America/New_York (UTC-04:00)
-
America/St_Kitts (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+3 (UTC-03:00)
-
America/Montevideo (UTC-03:00)
-
Brazil/East (UTC-03:00)
-
America/Argentina/Mendoza (UTC-03:00)
-
America/Argentina/Rio_Gallegos (UTC-03:00)
-
America/Catamarca (UTC-03:00)
-
America/Cordoba (UTC-03:00)
-
America/Sao_Paulo (UTC-03:00)
-
America/Argentina/Jujuy (UTC-03:00)
-
America/Cayenne (UTC-03:00)
-
America/Recife (UTC-03:00)
-
America/Buenos_Aires (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_Luis (UTC-03:00)
-
America/Argentina/Ushuaia (UTC-03:00)
-
Antarctica/Palmer (UTC-03:00)
-
America/Punta_Arenas (UTC-03:00)
-
America/Glace_Bay (UTC-03:00)
-
America/Fortaleza (UTC-03:00)
-
America/Thule (UTC-03:00)
-
America/Argentina/La_Rioja (UTC-03:00)
-
America/Belem (UTC-03:00)
-
America/Jujuy (UTC-03:00)
-
America/Bahia (UTC-03:00)
-
America/Goose_Bay (UTC-03:00)
-
America/Argentina/San_Juan (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_Aires (UTC-03:00)
-
America/St_Johns (UTC-02:30)
-
Canada/Newfoundland (UTC-02:30)
-
America/Miquelon (UTC-02:00)
-
Etc/GMT+2 (UTC-02:00)
-
America/Godthab (UTC-02:00)
-
America/Noronha (UTC-02:00)
-
Brazil/DeNoronha (UTC-02:00)
-
Atlantic/South_Georgia (UTC-02:00)
-
Etc/GMT+1 (UTC-01:00)
-
Atlantic/Cape_Verde (UTC-01:00)
-
Pacific/Kiritimati (UTC+14:00)
-
Etc/GMT-14 (UTC+14:00)
-
Pacific/Fakaofo (UTC+13:00)
-
Pacific/Enderbury (UTC+13:00)
-
Pacific/Apia (UTC+13:00)
-
Pacific/Tongatapu (UTC+13:00)
-
Etc/GMT-13 (UTC+13:00)
-
NZ-CHAT (UTC+12:45)
-
Pacific/Chatham (UTC+12:45)
-
Pacific/Kwajalein (UTC+12:00)
-
Antarctica/McMurdo (UTC+12:00)
-
Pacific/Wallis (UTC+12:00)
-
Pacific/Fiji (UTC+12:00)
-
Pacific/Funafuti (UTC+12:00)
-
Pacific/Nauru (UTC+12:00)
-
Kwajalein (UTC+12:00)
-
NZ (UTC+12:00)
-
Pacific/Wake (UTC+12:00)
-
Antarctica/South_Pole (UTC+12:00)
-
Pacific/Tarawa (UTC+12:00)
-
Pacific/Auckland (UTC+12:00)
-
Asia/Kamchatka (UTC+12:00)
-
Etc/GMT-12 (UTC+12:00)
-
Asia/Anadyr (UTC+12:00)
-
Pacific/Majuro (UTC+12:00)
-
Pacific/Ponape (UTC+11:00)
-
Pacific/Bougainville (UTC+11:00)
-
Antarctica/Macquarie (UTC+11:00)
-
Pacific/Pohnpei (UTC+11:00)
-
Pacific/Efate (UTC+11:00)
-
Pacific/Norfolk (UTC+11:00)
-
Asia/Magadan (UTC+11:00)
-
Pacific/Kosrae (UTC+11:00)
-
Asia/Sakhalin (UTC+11:00)
-
Pacific/Noumea (UTC+11:00)
-
Etc/GMT-11 (UTC+11:00)
-
Asia/Srednekolymsk (UTC+11:00)
-
Pacific/Guadalcanal (UTC+11:00)
-
Australia/Lord_Howe (UTC+10:30)
-
Australia/LHI (UTC+10:30)
-
Australia/Hobart (UTC+10:00)
-
Pacific/Yap (UTC+10:00)
-
Australia/Tasmania (UTC+10:00)
-
Pacific/Port_Moresby (UTC+10:00)
-
Australia/ACT (UTC+10:00)
-
Australia/Victoria (UTC+10:00)
-
Pacific/Chuuk (UTC+10:00)
-
Australia/Queensland (UTC+10:00)
-
Australia/Canberra (UTC+10:00)
-
Australia/Currie (UTC+10:00)
-
Pacific/Guam (UTC+10:00)
-
Pacific/Truk (UTC+10:00)
-
Australia/NSW (UTC+10:00)
-
Asia/Vladivostok (UTC+10:00)
-
Pacific/Saipan (UTC+10:00)
-
Antarctica/DumontDUrville (UTC+10:00)
-
Australia/Sydney (UTC+10:00)
-
Australia/Brisbane (UTC+10:00)
-
Etc/GMT-10 (UTC+10:00)
-
Asia/Ust-Nera (UTC+10:00)
-
Australia/Melbourne (UTC+10:00)
-
Australia/Lindeman (UTC+10:00)
-
Australia/North (UTC+09:30)
-
Australia/Yancowinna (UTC+09:30)
-
Australia/Adelaide (UTC+09:30)
-
Australia/Broken_Hill (UTC+09:30)
-
Australia/South (UTC+09:30)
-
Australia/Darwin (UTC+09:30)
-
Etc/GMT-9 (UTC+09:00)
-
Pacific/Palau (UTC+09:00)
-
Asia/Chita (UTC+09:00)
-
Asia/Dili (UTC+09:00)
-
Asia/Jayapura (UTC+09:00)
-
Asia/Yakutsk (UTC+09:00)
-
Asia/Pyongyang (UTC+09:00)
-
ROK (UTC+09:00)
-
Asia/Seoul (UTC+09:00)
-
Asia/Khandyga (UTC+09:00)
-
Japan (UTC+09:00)
-
Asia/Tokyo (UTC+09:00)
-
Australia/Eucla (UTC+08:45)
-
Asia/Kuching (UTC+08:00)
-
Asia/Chungking (UTC+08:00)
-
Etc/GMT-8 (UTC+08:00)
-
Australia/Perth (UTC+08:00)
-
Asia/Macao (UTC+08:00)
-
Asia/Macau (UTC+08:00)
-
Asia/Choibalsan (UTC+08:00)
-
Asia/Shanghai (UTC+08:00)
-
Antarctica/Casey (UTC+08:00)
-
Asia/Ulan_Bator (UTC+08:00)
-
Asia/Chongqing (UTC+08:00)
-
Asia/Ulaanbaatar (UTC+08:00)
-
Asia/Taipei (UTC+08:00)
-
Asia/Manila (UTC+08:00)
-
PRC (UTC+08:00)
-
Asia/Ujung_Pandang (UTC+08:00)
-
Asia/Harbin (UTC+08:00)
-
Singapore (UTC+08:00)
-
Asia/Brunei (UTC+08:00)
-
Australia/West (UTC+08:00)
-
Asia/Hong_Kong (UTC+08:00)
-
Asia/Makassar (UTC+08:00)
-
Hongkong (UTC+08:00)
-
Asia/Kuala_Lumpur (UTC+08:00)
-
Asia/Irkutsk (UTC+08:00)
-
Asia/Singapore (UTC+08:00)
-
Asia/Pontianak (UTC+07:00)
-
Etc/GMT-7 (UTC+07:00)
-
Asia/Phnom_Penh (UTC+07:00)
-
Asia/Novosibirsk (UTC+07:00)
-
Antarctica/Davis (UTC+07:00)
-
Asia/Tomsk (UTC+07:00)
-
Asia/Jakarta (UTC+07:00)
-
Asia/Barnaul (UTC+07:00)
-
Indian/Christmas (UTC+07:00)
-
Asia/Ho_Chi_Minh (UTC+07:00)
-
Asia/Hovd (UTC+07:00)
-
Asia/Bangkok (UTC+07:00)
-
Asia/Vientiane (UTC+07:00)
-
Asia/Novokuznetsk (UTC+07:00)
-
Asia/Krasnoyarsk (UTC+07:00)
-
Asia/Saigon (UTC+07:00)
-
Asia/Yangon (UTC+06:30)
-
Asia/Rangoon (UTC+06:30)
-
Indian/Cocos (UTC+06:30)
-
Asia/Kashgar (UTC+06:00)
-
Etc/GMT-6 (UTC+06:00)
-
Asia/Almaty (UTC+06:00)
-
Asia/Dacca (UTC+06:00)
-
Asia/Omsk (UTC+06:00)
-
Asia/Dhaka (UTC+06:00)
-
Indian/Chagos (UTC+06:00)
-
Asia/Qyzylorda (UTC+06:00)
-
Asia/Bishkek (UTC+06:00)
-
Antarctica/Vostok (UTC+06:00)
-
Asia/Urumqi (UTC+06:00)
-
Asia/Thimbu (UTC+06:00)
-
Asia/Thimphu (UTC+06:00)
-
Asia/Kathmandu (UTC+05:45)
-
Asia/Katmandu (UTC+05:45)
-
Asia/Kolkata (UTC+05:30)
-
Asia/Colombo (UTC+05:30)
-
Asia/Calcutta (UTC+05:30)
-
Asia/Aqtau (UTC+05:00)
-
Etc/GMT-5 (UTC+05:00)
-
Asia/Samarkand (UTC+05:00)
-
Asia/Karachi (UTC+05:00)
-
Asia/Yekaterinburg (UTC+05:00)
-
Asia/Dushanbe (UTC+05:00)
-
Indian/Maldives (UTC+05:00)
-
Asia/Oral (UTC+05:00)
-
Asia/Tashkent (UTC+05:00)
-
Antarctica/Mawson (UTC+05:00)
-
Asia/Aqtobe (UTC+05:00)
-
Asia/Ashkhabad (UTC+05:00)
-
Asia/Ashgabat (UTC+05:00)
-
Asia/Atyrau (UTC+05:00)
-
Indian/Kerguelen (UTC+05:00)
-
Iran (UTC+04:30)
-
Asia/Tehran (UTC+04:30)
-
Asia/Kabul (UTC+04:30)
-
Asia/Yerevan (UTC+04:00)
-
Etc/GMT-4 (UTC+04:00)
-
Etc/GMT-4 (UTC+04:00)
-
Asia/Dubai (UTC+04:00)
-
Indian/Reunion (UTC+04:00)
-
Europe/Saratov (UTC+04:00)
-
Europe/Samara (UTC+04:00)
-
Indian/Mahe (UTC+04:00)
-
Asia/Baku (UTC+04:00)
-
Asia/Muscat (UTC+04:00)
-
Europe/Volgograd (UTC+04:00)
-
Europe/Astrakhan (UTC+04:00)
-
Asia/Tbilisi (UTC+04:00)
-
Europe/Ulyanovsk (UTC+04:00)
-
Asia/Aden (UTC+03:00)
-
Africa/Nairobi (UTC+03:00)
-
Europe/Istanbul (UTC+03:00)
-
Etc/GMT-3 (UTC+03:00)
-
Europe/Zaporozhye (UTC+03:00)
-
Israel (UTC+03:00)
-
Indian/Comoro (UTC+03:00)
-
Antarctica/Syowa (UTC+03:00)
-
Africa/Mogadishu (UTC+03:00)
-
Europe/Bucharest (UTC+03:00)
-
Africa/Asmera (UTC+03:00)
-
Europe/Mariehamn (UTC+03:00)
-
Asia/Istanbul (UTC+03:00)
-
Europe/Tiraspol (UTC+03:00)
-
Europe/Moscow (UTC+03:00)
-
Europe/Chisinau (UTC+03:00)
-
Europe/Helsinki (UTC+03:00)
-
Asia/Beirut (UTC+03:00)
-
Asia/Tel_Aviv (UTC+03:00)
-
Africa/Djibouti (UTC+03:00)
-
Europe/Simferopol (UTC+03:00)
-
Europe/Sofia (UTC+03:00)
-
Asia/Gaza (UTC+03:00)
-
Africa/Asmara (UTC+03:00)
-
Europe/Riga (UTC+03:00)
-
Asia/Baghdad (UTC+03:00)
-
Asia/Damascus (UTC+03:00)
-
Africa/Dar_es_Salaam (UTC+03:00)
-
Africa/Addis_Ababa (UTC+03:00)
-
Europe/Uzhgorod (UTC+03:00)
-
Asia/Jerusalem (UTC+03:00)
-
Asia/Riyadh (UTC+03:00)
-
Asia/Kuwait (UTC+03:00)
-
Europe/Kirov (UTC+03:00)
-
Africa/Kampala (UTC+03:00)
-
Europe/Minsk (UTC+03:00)
-
Asia/Qatar (UTC+03:00)
-
Europe/Kiev (UTC+03:00)
-
Asia/Bahrain (UTC+03:00)
-
Europe/Vilnius (UTC+03:00)
-
Indian/Antananarivo (UTC+03:00)
-
Indian/Mayotte (UTC+03:00)
-
Europe/Tallinn (UTC+03:00)
-
Turkey (UTC+03:00)
-
Africa/Juba (UTC+03:00)
-
Asia/Nicosia (UTC+03:00)
-
Asia/Famagusta (UTC+03:00)
-
W-SU (UTC+03:00)
-
EET (UTC+03:00)
-
Asia/Hebron (UTC+03:00)
-
Asia/Amman (UTC+03:00)
-
Europe/Nicosia (UTC+03:00)
-
Europe/Athens (UTC+03:00)
-
Africa/Cairo (UTC+02:00)
-
Africa/Mbabane (UTC+02:00)
-
Europe/Brussels (UTC+02:00)
-
Europe/Warsaw (UTC+02:00)
-
CET (UTC+02:00)
-
Europe/Luxembourg (UTC+02:00)
-
Etc/GMT-2 (UTC+02:00)
-
Libya (UTC+02:00)
-
Africa/Kigali (UTC+02:00)
-
Africa/Tripoli (UTC+02:00)
-
Europe/Kaliningrad (UTC+02:00)
-
Africa/Windhoek (UTC+02:00)
-
Europe/Malta (UTC+02:00)
-
Europe/Busingen (UTC+02:00)
-
Europe/Skopje (UTC+02:00)
-
Europe/Sarajevo (UTC+02:00)
-
Europe/Rome (UTC+02:00)
-
Europe/Zurich (UTC+02:00)
-
Europe/Gibraltar (UTC+02:00)
-
Africa/Lubumbashi (UTC+02:00)
-
Europe/Vaduz (UTC+02:00)
-
Europe/Ljubljana (UTC+02:00)
-
Europe/Berlin (UTC+02:00)
-
Europe/Stockholm (UTC+02:00)
-
Europe/Budapest (UTC+02:00)
-
Europe/Zagreb (UTC+02:00)
-
Europe/Paris (UTC+02:00)
-
Africa/Ceuta (UTC+02:00)
-
Europe/Prague (UTC+02:00)
-
Antarctica/Troll (UTC+02:00)
-
Africa/Gaborone (UTC+02:00)
-
Europe/Copenhagen (UTC+02:00)
-
Europe/Vienna (UTC+02:00)
-
Europe/Tirane (UTC+02:00)
-
MET (UTC+02:00)
-
Europe/Amsterdam (UTC+02:00)
-
Africa/Maputo (UTC+02:00)
-
Europe/San_Marino (UTC+02:00)
-
Poland (UTC+02:00)
-
Europe/Andorra (UTC+02:00)
-
Europe/Oslo (UTC+02:00)
-
Europe/Podgorica (UTC+02:00)
-
Africa/Bujumbura (UTC+02:00)
-
Atlantic/Jan_Mayen (UTC+02:00)
-
Africa/Maseru (UTC+02:00)
-
Europe/Madrid (UTC+02:00)
-
Africa/Blantyre (UTC+02:00)
-
Africa/Lusaka (UTC+02:00)
-
Africa/Harare (UTC+02:00)
-
Africa/Khartoum (UTC+02:00)
-
Africa/Johannesburg (UTC+02:00)
-
Europe/Belgrade (UTC+02:00)
-
Europe/Bratislava (UTC+02:00)
-
Arctic/Longyearbyen (UTC+02:00)
-
Egypt (UTC+02:00)
-
Europe/Vatican (UTC+02:00)
-
Europe/Monaco (UTC+02:00)
-
Europe/London (UTC+01:00)
-
Etc/GMT-1 (UTC+01:00)
-
Europe/Jersey (UTC+01:00)
-
Europe/Guernsey (UTC+01:00)
-
Europe/Isle_of_Man (UTC+01:00)
-
Africa/Tunis (UTC+01:00)
-
Africa/Malabo (UTC+01:00)
-
GB-Eire (UTC+01:00)
-
Africa/Lagos (UTC+01:00)
-
Africa/Algiers (UTC+01:00)
-
GB (UTC+01:00)
-
Portugal (UTC+01:00)
-
Africa/Sao_Tome (UTC+01:00)
-
Africa/Ndjamena (UTC+01:00)
-
Atlantic/Faeroe (UTC+01:00)
-
Eire (UTC+01:00)
-
Atlantic/Faroe (UTC+01:00)
-
Europe/Dublin (UTC+01:00)
-
Africa/Libreville (UTC+01:00)
-
Africa/El_Aaiun (UTC+01:00)
-
Africa/El_Aaiun (UTC+01:00)
-
Africa/Douala (UTC+01:00)
-
Africa/Brazzaville (UTC+01:00)
-
Africa/Porto-Novo (UTC+01:00)
-
Atlantic/Madeira (UTC+01:00)
-
Europe/Lisbon (UTC+01:00)
-
Atlantic/Canary (UTC+01:00)
-
Africa/Casablanca (UTC+01:00)
-
Europe/Belfast (UTC+01:00)
-
Africa/Luanda (UTC+01:00)
-
Africa/Kinshasa (UTC+01:00)
-
Africa/Bangui (UTC+01:00)
-
WET (UTC+01:00)
-
Africa/Niamey (UTC+01:00)
-
GMT (UTC+00:00)
-
Etc/GMT-0 (UTC+00:00)
-
Atlantic/St_Helena (UTC+00:00)
-
Etc/GMT+0 (UTC+00:00)
-
Africa/Banjul (UTC+00:00)
-
Etc/GMT (UTC+00:00)
-
Africa/Freetown (UTC+00:00)
-
Africa/Bamako (UTC+00:00)
-
Africa/Conakry (UTC+00:00)
-
Universal (UTC+00:00)
-
Africa/Nouakchott (UTC+00:00)
-
UTC (UTC+00:00)
-
Etc/Universal (UTC+00:00)
-
Atlantic/Azores (UTC+00:00)
-
Africa/Abidjan (UTC+00:00)
-
Africa/Accra (UTC+00:00)
-
Etc/UCT (UTC+00:00)
-
GMT0 (UTC+00:00)
-
Zulu (UTC+00:00)Zulu (UTC+00:00)
-
Africa/Ouagadougou (UTC+00:00)
-
Atlantic/Reykjavik (UTC+00:00)
-
Etc/Zulu (UTC+00:00)
-
Iceland (UTC+00:00)
-
Africa/Lome (UTC+00:00)
-
Greenwich (UTC+00:00)
-
Etc/GMT0 (UTC+00:00)
-
America/Danmarkshavn (UTC+00:00)
-
Africa/Dakar (UTC+00:00)
-
Africa/Bissau (UTC+00:00)
-
Etc/Greenwich (UTC+00:00)
-
Africa/Timbuktu (UTC+00:00)
-
UCT (UTC+00:00)
-
Africa/Monrovia (UTC+00:00)
-
Etc/UTC (UTC+00:00)
Using 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.
Formula expressions can only output double values. Nested expressions can output other data types, such as strings, but the formula as a whole must evaluate to a number. You can use the jp function to convert a string to a number. If you define a formula that computes a non-numeric value, AWS IoT SiteWise doesn't output a data point for that computation. For more information, see Undefined, infinite, and overflow values.
AWS IoT SiteWise provides the following formula expression features that you can use to operate on strings:
-
The index operator (
s[index]
) -
The slice operator (
s[start:end:step]
) -
Comparison functions, which you can use compare strings by lexicographic order
-
String functions, which includes the
jp
function that can parse serialized JSON objects and convert strings to numbers
Filtering data points
You can use the if function 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 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 an condition is met, and returnsnone
as either theresult_if_true
orresult_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.
Counting data points that match a condition
You can use comparison functions and sum() to count the number of data points for which a condition is true.
To count data points that match a condition
-
Create a transform that uses a comparison function to define a filter condition on another property.
-
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)
– Returns1
if the temperature is greater than or equal to 100 degrees Celsius, otherwise returns0
. -
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.
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 Querying asset property values and aggregates.
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, 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)
isnone
whentemp
is less than300
.