If you do not set a filter, all objects for the container type will be returned when the container is populated. You can set one or more filters on a container.
The SmsCreateFilter function takes three parameters:
Example:
// Create a job filter.
HANDLE hFilter;
stat = SmsCreateFilter( JOB_FILTER, // Type of filter.
hConnect, // Handle to database
// connection.
&hFilter // Assign handle to new filter
); // to hFilter.
To add a token to a filter, use the SmsAddToken function.
The SmsAddToken function takes four parameters:
Example:
// Add a token to the job filter that
// finds all Run Command On Workstation jobs.
TOKEN Token;
// Clear the Token structure.
memset( &Token, 0, sizeof (TOKEN) );
// Set the expression token to
// "JobType is equal to Install".
// Set the attribute name to JobType.
strcpy( Token.szName, "JobType");
// Set the operator used to evaluate the expression.
Token.dwOp = QOP_STR_EQ; // Use the equals operator.
// Set the value to evaluate.
strcpy( Token.szValue, "Install");
// Add the token to the filter.
stat = SmsAddToken( hFilter, // Specifies the handle to filter.
OP_AND, // Use the AND control token to
// connect the expression to
// adjacent expressions.
&Token, // Specifies the structure
// containing the expression
// token.
AT_END // Add the token to the end of
// the filter.
);
The SmsSetFilter function takes two parameters:
// Apply the filter to the container.
stat = SmsSetFilter ( hContainer, // Handle to container.
hFilter // Handle to filter.
);