Also available as:
loading table of contents...

Using Stellar to Transform Sensor Data Elements

You can use Stellar to customize sensor data elements to more useful information. For example, you can transform a timestamp to be specific to your timezone.

TO_EPOCH_TIMESTAMP(timestamp, 'yyyy-MM-dd HH:mm:ss', MAP_GET(dc, dc2tz, 'UTC'))

For a message with a timestamp and dc field, we want to transform the timestamp to an epoch timestamp given a timezone that we will look up in a separate map, called dc2tz.

This converts the timestamp field to an epoch timestamp based on the following:

  • Format yyyy-MM-dd HH:mm:ss

  • The value in dc2tz associated with the value associated with field dc, defaulting to UTC

The following is a list of Stellar transformation functions currently supported by HCP:


Transforms the first argument to a lowercase string


Transforms the first argument to an uppercase string


Transforms the first argument to a string


Transforms the first argument to an integer


Transforms the first argument to a double


Trims white space from both sides of a string

JOIN(list, delim)

Joins the components of the list with the specified delimiter

SPLIT(string, delim)

Splits the string by the delimiter. Returns a list.


Returns the first element of the list


Returns the last element of the list

GET(list, i)

Returns the i'th element of the list (i is 0-based).

MAP_GET(key, map, default)

Returns the value associated with the key in the map. If the key does not exist, the default will be returned. If the default is unspecified, then null will be returned.


Returns the TLD of the domain


Removes the TLD of the domain.


Removes the TLD from the domain


Returns the host from a URL


Returns the protocol from a URL


Returns the port from a URL


Returns the path from a URL

TO_EPOCH_TIMESTAMP(dateTime, format, timezone)

Returns the epoch timestamp of the dateTime given the format

If the format does not have a timestamp and you wish to assume a given timestamp, you may specify the timezone optionally.