Windows Media Player 11 SDK Query.addCondition
Previous | Next |
Query.addCondition
The addCondition method adds a condition to the Query object using AND logic.
Syntax
player.mediaCollection.createQuery().addCondition( attribute , operator, value)
Parameters
attribute
String containing the attribute name.
operator
String containing the operator. See Remarks for supported values.
value
String containing the attribute value.
Return Values
This method does not return a value.
Remarks
Compound queries using Query are not case sensitive.
A list of values for the attribute parameter can be found in the Alphabetical Attribute Reference section.
Conditions contained in a Query object are organized into condition groups. Multiple conditions within a condition group are always concatenated using AND logic. Condition groups are always concatenated to each other using OR logic. To start a new condition group, call Query.beginNextGroup.
The following table lists the supported values for operator.
Operator | Applies to |
BeginsWith | Strings |
Contains | Strings |
Equals | All types |
GreaterThan | Numbers, Dates |
GreaterThanOrEquals | Numbers, Dates |
LessThan | Numbers, Dates |
LessThanOrEquals | Numbers, Dates |
NotBeginsWith | Strings |
NotContains | Strings |
NotEquals | All types |
Example Code
The following JScript example uses Query.addCondition and Query.beginNextGroup to perform an example query.
// Perform an example query for media for which: // The genre contains "jazz" // and the title begins with "a" // OR the genre contains "jazz" // and the author begins with "b". // Create the query object. var Query = Player.mediaCollection.createQuery(); // Add the first condition group. Query.addCondition("WM/Genre", "Contains", "jazz"); Query.addCondition("Title", "BeginsWith", "a"); // Begin the new condition group ("or"). Query.beginNextGroup(); // Add the second condition group. Query.addCondition("WM/Genre", "Contains", "jazz"); Query.addCondition("Author", "BeginsWith", "b"); // Perform the query on "audio" media. var Playlist = Player.mediaCollection.getPlaylistByQuery( Query, // query "audio", // mediaType "", // sortAttribute false); // sortAscending
Requirements
Version: Windows Media Player 11.
Library: Use wmp.dll.
See Also
- MediaCollection.createQuery
- MediaCollection.getPlaylistByQuery
- MediaCollection.getStringCollectionByQuery
- Query Object
- Query.beginNextGroup
Previous | Next |