Tokens
Filters and inventory rules folders are composed of expression tokens that are combined by control tokens:
-
Expression token
-
For filters, an expression token defines how to search for objects that have a specified relationship to a specified value for a specified attribute. An expression token is made up of an attribute, a relational operator, and a comparison value. A relational operator (such as "is equal to" or "is like") defines how the specified value should be compared with the actual value stored for the specified attribute. Depending on the type of filter that contains the token, an expression token's TOKEN structure uses the szName, szArchitecture, szGroupClass, and szAttributeName members to define the attribute. For example, job filters (and most other filters) use the szName member to specify the attribute, whereas machine filters use the szArchitecture, szGroupClass, and szAttributeName members.
For inventory rules folders, expression tokens represent the rule for collecting inventory on the package. An expression token uses only the szTokenString member of the TOKEN structure. The szTokenString member specifies the attributes that identify the file.
-
Control token
-
For both filters and inventory rules folders, a control token can be a logical operator or parentheses. A logical operator connects two expression tokens, two subclauses, or a combination of an expression and a subclause. A logical operator defines the relationship between two adjacent expressions or subclauses. Parentheses enable expressions to be grouped together.
There are two logical operators:
-
AND
-
Finds all objects that satisfy both expression tokens or subclauses connected by AND. You can use AND to narrow the list of objects you want to find. For example, the following filter finds all computers that have an 80386 processor, 4 MB of extended memory, and Microsoft Excel:
MICROSOFT|PROCESSOR|1.0:Processor Name is like '%386%'
AND
MICROSOFT|X86_PC_MEMORY|1.0:Extended Memory (KByte) is greater than '4000'
AND
MICROSOFT|SOFTWARE|1.0:Name is like '%Excel%'
This filter returns a list of computers that satisfied all three expression tokens.
-
OR
-
Finds all objects that satisfy either (or both) of the two expression tokens or subclauses connected by the OR. You can use OR to assemble a set of objects. For example, the following filter finds all computers that have an 80386 processor, 4 MB of extended memory, or Microsoft Excel—or any combination of the three:
MICROSOFT|PROCESSOR|1.0:Processor Name is like '%386%'
OR
MICROSOFT|X86_PC_MEMORY|1.0:Extended Memory (KByte) is greater than '4000'
OR
MICROSOFT|SOFTWARE|1.0:Software Name is like '%Excel%'
This filter returns a list of all computers that satisfied any one (or any combination) of the three expression tokens.
For additional information about logical operators, see Handling Tokens.