Querying datapoints in Analytics

Within the custom SQL editor in Formant Analytics, you can view and query datapoints and streams in your organization.

Viewing available data point parameters to query in the custom SQL editor.

Viewing available datapoint parameters to query in the custom SQL editor.

This guide will walk you through the table structure for stream data in Formant Analytics, and teach you how to query stream data by the available parameters.

Stream table structure explained

Data stream types

Data streams in Formant are categorized in the following way:

Table name
query_battery
query_bitset
query_health
query_json
query_numeric
query_numeric_set
query_text

Universal parameters

All data tables can be queried by the following parameters:

ParameterDescription
organization_idOrganization ID related to this datapoint.
device_idDevice ID related to this datapoint.
nameName of the stream associated with this datapoint.
tagsTags associated with this device or datapoint, used for filtering.
timeTimestamp associated with this datapoint.

The value parameter

Each table has a unique format for the value parameter, which represents the data structure of that stream's datapoints:

Table namevalue parameter format
query_batteryquery_battery does not have a value parameter, but instead has the following parameters:

- percentage: number between 0 and 100
- voltage: number
- charge: number
query_bitsetKey-value pair of the form: Map(String, Bool)
query_healthquery_health does not have a value parameter, but instead has a status parameter of type string.
query_jsonstring containing JSON data.
query_numericnumber
query_numeric_setArray of:

- label: string
- value: number
- unit: string Map(String,Tuple(value Float64, unit String))
query_textstring

Example: Query a numeric stream

In the context of Formant Analytics, we can think of a stream's data as the value column of a table when the namecolumn is filtered for a given stream name.

For example, consider the following query_numeric table:

organization_iddevice_idnametagstimevalue
org adevice 1berry_radiusberry-stats12:00 PM12.2
org adevice 1berry_diameterberry-stats12:00 PM28.8
org adevice 1pick_durationberry-stats12:01 PM2.2
org adevice 1pick_durationberry-stats12:02 PM1.7
org adevice 1berry_radiusberry-stats12:02 PM14.5
org adevice 1berry_diameterberry-stats12:03 PM25.9
org adevice 1pick_durationberry-stats12:03 PM5.3
org adevice 1berry_radiusberry-stats12:05 PM10.7

The query_numeric table contains all stream data for numeric streams in org a. To query the data for the stream berry_radius, we filter query_numeric by name berry_radius for the following result:

organization_iddevice_idnametagstimevalue
org adevice 1berry_radiusberry-stats12:00 PM12.2
org adevice 1berry_radiusberry-stats12:02 PM14.5
org adevice 1berry_radiusberry-stats12:05 PM10.7

The above structure for stream names applies for all tables with a name and value field.

See also

👋

If you notice an issue with this page or need help, please reach out to us! Use the 'Did this page help you?' buttons below, or get in contact with our Customer Success team via the Intercom messenger in the bottom-right corner of this page, or at [email protected].