ClipGetCount function

The ClipGetCount function returns the number of elements in the current time series that occur in the period delimited by the time stamps.

Syntax

ClipGetCount(ts TimeSeries, 
       begin_stamp datetime year to fraction(5) default NULL, 
       end_stamp   datetime year to fraction(5) default NULL,
        flags       integer default 0) 
returns integer;
ts
The source time series.
begin_stamp
The begin point of the range. Can be NULL.
end_stamp
The end point of the range. Can be NULL.
flags
Valid values for the flags argument are described later in this topic.

Description

For an irregular time series, deleted elements are not counted. For a regular time series, only entries that are non-null are counted, so ClipGetCount might return a different value than GetNelems.

If the begin point is NULL, the time series origin is used. If the end point is NULL, the end of the time series is used.

See Clip function for more information about the begin and end points of the range.

The flags argument values

The flags argument determines how a scan should work on the returned set. If you set the flags argument to 0 (the default), null and hidden elements are not part of the count. If the flags argument has a value of 512 (0x200) (the TS_SCAN_HIDDEN bit is set), all non-null elements are counted whether they are hidden or not.
Flag Value Meaning
TSOPEN_RDWRITE 0 (Default) Hidden elements are not included in the count.
TS_SCAN_HIDDEN 512 Hidden elements marked by HideElem are included in the count (see HideElem function).

Returns

The number of elements in the given time series that occur in the period delimited by the time stamps.

Example

The following statement returns the number of elements between 10:30 a.m. on March 14, 2011, and midnight on March 19, 2011, inclusive:
select ClipGetCount(activity_data,
   '2011-03-14 10:30:00.00000','2011-03-19 00:00:00.00000')
    from activity_stocks
    where stock_id = 600;

Copyright© 2018 HCL Technologies Limited