WITH DATA CATEGORYfilteringExpression

The optional WITH DATA CATEGORY clause is used in a SELECT statement to filter records based on their classification in one or more data category groups. If WITH DATA CATEGORY is specified, the query() only returns matching records that are associated with the specified data categories and are visible to the user. If unspecified, the query() only returns the matching records that are visible to the user.

Important
CategoryData is an object and DATA CATEGORY is syntax in a SOQL WITH clause. WITH DATA CATEGORY is valid syntax, but WITH CategoryData is not supported.
A SOQL statement using a WITH DATA CATEGORY clause must also include a FROM ObjectTypeName clause where ObjectTypeName equals:When ObjectTypeName equals to KnowledgeArticleVersion or any article type API Name in the FROM clause, a WHERE clause must be specified with one of the following parameters:

For information on article types or questions, see “Managing Article Types” and “Finding and Viewing Questions” in the Salesforce online help.

Note
The WITH DATA CATEGORY clause does not support bind variables.

filteringExpression

The filteringExpression in the WITH DATA CATEGORY clause uses the following syntax:

dataCategorySelection [ANDdataCategorySelection2 ...]

The examples in this section are based on the following data category group:

Geography__c
    ww__c
        northAmerica__c
            usa__c
            canada__c
            mexico__c
        europe__c
            france__c
            uk__c
        asia__c

The category filtering in the statements below is highlighted in bold. The syntax is explained in the following sections.

You can only use the AND logical operator. The following syntax is incorrect as OR is not supported:

WITH DATA CATEGORY Geography__c ABOVE usa__c OR Product__c AT mobile_phones__c
© Copyright 2000–2012 salesforce.com, inc. All rights reserved.
Various trademarks held by their respective owners.