Querying Multi-Select Picklists

Client applications use a specific syntax for querying multi-select picklists (in which multiple items can be selected).

Supported Operators

The following operators are supported for querying multi-select picklists:

Operator Description
= Equals the specified string.
!= Does not equal the specified string.
includes Includes (contains) the specified string.
excludes Excludes (does not contain) the specified string.

Semicolon Character

A semicolon is used as a special character to specify AND. For example, the following notation means ' AAA' and ' BBB':

'AAA;BBB'

Specifying AND is used for multi-select picklists when two or more items must be selected.

Examples

In the following example SOQL notation, the query filters on values in the MSP1__c field that are equal to AAA and BBB selected (exact match):

MSP1__c = 'AAA;BBB'

In the following example SOQL notation:

MSP1__c includes ('AAA;BBB','CCC')

the query filters on values in the MSP1__c field that contains either of these values:

  • AAA and BBB selected.
  • CCC selected.

A match will result on any field value that contains 'AAA' and 'BBB' or any field that contains 'CCC'. For example, the following will be matched:

  • matches with ' AAA;BBB':
             'AAA;BBB'
             'AAA;BBB;DDD'
  • matches with ' CCC':
             'CCC'
             'CCC;EEE'
             'AAA;CCC'   
© Copyright 2000-2008 salesforce.com, inc. All rights reserved.
Various trademarks held by their respective owners.