smc_create_filter

Description

Creates a filter on a data item in a view. Each data item in a view can have only one filter.

This function can be used with both Monitor Server and Historical Server. When used with Historical Server (that is, when the connection mode is SMC_SERVER_M_HISTORICAL), it creates a filter for the recording session that is being defined.

Syntax

SMC_RETURN_CODE 		smc_create_filter
 (SMC_CONNECT_ID         clientId,
SMC_VIEW_ID            viewId,
  SMC_DATAITEM_STRUCTP   dataItemHandle,
  SMC_FILTER_TYPE        filterType,
  SMC_VALUE_UNIONP       filterValueListHandle,
  SMC_SIZET              filterValueListLength,
  SMC_DATAITEM_TYPE      filterDatatype,
  SMC_FILTER_IDP         filterIdHandle)

Parameters

clientId

identifies the connection.

viewId

identifies a view created on the connection.

dataItemHandle

data item and statistic type. The data item must be numeric if the filter type is any of the following:

filterType

type of filter to apply. Valid filter types are:

filterValueListHandle

pointer to an array of filter values. The number of filter values depends on the filter type:

filterValueListLength

number of filter values listed in filterValueListHandle.

filterDataType

datatype of the values for the filter; one of the following:

Must match the datatype for the data item. The filter values must also be of this type, except:

filterIdHandle

pointer to a variable, which should be declared as type SMC_FILTER_ID. If the call to smc_create_filter succeeds, this variable contains the ID for the filter.

Returns

Return value

Indicates

SMC_RET_SUCCESS

Function succeeded.

SMC_RET_FAILURE

Function failed.

SMC_RET_INVALID_CONNECT

Connection does not exist.

Examples

Example 1

The following example assumes that:

Usage


Valid server modes

Mode

Availability

SMC_SERVER_M_LIVE

Yes

SMC_SERVER_M_HISTORICAL

Yes (for recording only)


Errors

Error

Indicates

SMC_RET_INSUFFICIENT_MEMORY

Insufficient memory

SMC_RET_INVALID_COMPOSITE_FILTER

Invalid composite filter

SMC_RET_MISSING_DATAITEM

Missing data item

SMC_RET_INVALID_DATATYPE

Invalid datatype

SMC_RET_INVALID_DINAME

Invalid data item

SMC_RET_INVALID_DISTAT

Invalid data item statistic type

SMC_RET_INVALID_FILTER_VALUE

Invalid value for filter

SMC_RET_INVALID_FILTER_RANGE

Invalid range values

SMC_RET_INVALID_VALUE_COUNT

Invalid value for filterValueListLength

SMC_RET_INVALID_VIEWID

View does not exist

See also

smc_drop_filter