InstanceId function

The InstanceId function determines if the time series is stored in a container and, if it is, returns the instance ID of that time series.

Syntax

InstanceId(ts TimeSeries) 
returns integer;
InstanceId(ts TimeSeries) 
returns bigint;
ts
The source time series.

Description

The instance ID is used as an index in the container. It can also be used to lookup information from the TSInstanceTable table.

Returns

The instance ID associated with the specified time series, unless the time series is stored in a row rather than in a container, in which case the return value is -1.

Example

The following example gets the instance IDs for each stock in the activity_stocks table:
select stock_id, InstanceId(activity_data) from activity_stocks;