GetNelems function

The GetNelems function returns the number of elements stored in a time series.

Syntax

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

Description

For regular time series, GetNelems also counts null elements before the last non-null element, so GetNelems might not return the same results as ClipGetCount, which does not count null elements.

Returns

The number of elements in the time series.

NULL if the time series does not exist.

Example

The following query returns all stocks containing fewer than 355 elements:
select stock_name from daily_stocks
where GetNelems(stock_data) < 355;
The following query returns the last five elements of each time series:
select Clip(stock_data, GetNelems(stock_data) - 4,
   GetNelems(stock_data))
from daily_stocks where stock_name = 'IBM';

This example only works if the time series has more than four elements.