Query Syntax

The query syntax for the searchspec argument supports only a small subset of binary and unary operators. No Siebel Query Language constructs or functions are supported. The query syntax is summarized in the following table.

Table Query Syntax for Query Page

Syntax Type Notes

expression

[XML Tag] {Operator} {Value}

Operator can be binary or unary. The {Value} need only be specified for binary operators.

(expression) conjunction (expression)

A conjugated expression must be enclosed in parentheses to avoid ambiguity. However, nonconjugated expressions must not be enclosed in parentheses.

conjunction

OR

None

AND

None

unary operator

IS NULL

Used to find a match for a value that has no value

IS NOT NULL

None

EXISTS

See The EXISTS and NOT EXISTS Operators

NOT EXISTS

None

binary operator

=

None

~=

Denotes a case-insensitive exact search (no wildcards used)

<

Must be specified as &lt; to ensure well-formed XML.

<=

Must be specified as &lt;=

>

None

>=

None

<>

Must be specified as &lt;>

LIKE

Wildcard characters are treated as such only in the context of the operator LIKE.

~LIKE

Denotes a case-insensitive wildcard search

value

'literal'

Literal data is always enclosed in single quotes.

To use a single quote within a literal, place another single quote immediately beside that quote. In this way, the query recognizes the quote as a literal and not as an operator. For example, the string ab'c is specified as ab''c.

To use the special characters such as asterisk (*), question mark (?), and backslash (\) in queries, preceded them with the \ character. For example, to use the ? wildcard operator in a query, precede it with the \ character as follows:

\?

Caution: Queries that are case-insensitive or with leading wildcard characters will perform slowly and must only be used when necessary. In some cases, you can however use shadow fields, see Using Shadow Fields for Better Search Performance.

The following is an example from a request that follows the query syntax:

<Contact searchspec= "[ContactFirstName] =  'John ' ">

where XML Tag is Contact FirstName, the operator is = and the value is the literal value John.

An example of an expression with a conjunction is as follows:

<Contact searchspec= "[ContactFirstName] = 'Jane ' ) AND [ContactLastName] = 'Doe ' ")>

Examples of searchspec usage are given in the following table.

Table Searchspec Examples

Operator Usage of searchspec in request Description

Case Sensitive LIKE with * wildcard

<ListOfContact startrownum="0" pagesize="100" 
recordcountneeded="true">
<Contact searchspec="[ContactFirstName] LIKE 
 'Contact* '">
<ContactFirstName/>
</Contact></ListOfContact>

Returns all contacts whose ContactFirstName value starts with "Contact" and ends with zero or more characters

Case Insensitive ~ LIKE with * wildcard

<ListOfContact><Contact 
searchspec="[ContactFirstName] ~LIKE 
 'Contact* '">
<ContactFirstName/>
</Contact></ListOfContact>

Returns all contacts whose ContactFirstName value starts with, for example, "Contact" or "contact" or "CoNtAcT" and ends with zero or more characters

Case Sensitive LIKE with ? wildcard

<ListOfContact><Contact 
searchspec="[ContactFirstName] LIKE 
 'Contact??? '">
<ContactFirstName/>
</Contact></ListOfContact>

Returns all contacts whose ContactFirstName value starts with "Contact" and ends with any three characters

Case Insensitive ~ LIKE with ? wildcard

<ListOfContact><Contact 
searchspec="[ContactFirstName] ~LIKE 
 'Contact??? '">
<ContactFirstName/>
</Contact></ListOfContact>

Returns all contacts whose ContactFirstName value starts with, for example, "Contact" or "contact" or "CoNtAcT", and ends with any three characters

Case Sensitive =

<ListOfContact><Contact 
searchspec="[ContactFirstName] = 
 'ContactInsert '">
<ContactFirstName/>
</Contact></ListOfContact>

Returns all contacts whose ContactFirstName value is equal to "ContactInsert"

Case Insensitive ~=

<ListOfContact><Contact 
searchspec="[ContactFirstName] ~= 
 'ContactInsert '">'
<ContactFirstName/>
</Contact></ListOfContact>

Returns all contacts whose ContactFirstName value is equal to, for example, "ContactInsert","contactinsert" or "CoNtAcTiNsErT"

IS NULL

<ListOfContact><Contact searchspec="[TEXTLG_000] 
IS NULL">
<ContactFirstName/>
</Contact></ListOfContact>

Returns all contacts whose TEXTLG_000 value is NULL

IS NOT NULL

<ListOfContact><Contact searchspec="[TEXTLG_000]
IS NOT NULL">
<ContactFirstName/>
</Contact></ListOfContact> 

Returns all contacts whose TEXTLG_000 value is not NULL

AND

<ListOfContact><Contact searchspec="[BOOL_000] =
'Y' AND [IndexedBoolean0] = 'N'"> 
<ContactFirstName/><IndexedBoolean0/> 
</Contact></ListOfContact> 

Or

<ListOfContact>
<Contact searchspec="[BOOL_000] = 'Y'">
<ContactFirstName/>
<IndexedBoolean0>='N'</IndexedBoolean0>
</Contact></ListOfContact> 

Or

<ListOfContact><Contact>
<ContactFirstName/>
<BOOL_000>='Y'</BOOL_000>
<IndexedBoolean0>='N'</IndexedBoolean0>
</Contact></ListOfContact>

Returns all contacts whose BOOL_000 value is Y AND IndexedBoolean0 value is N

OR

<ListOfContact><Contact searchspec="[BOOL_000] =
'Y' OR [IndexedBoolean0] = 'N'"> 
<ContactFirstName/>
<BOOL_000/>
<IndexedBoolean0/> 
</Contact></ListOfContact> 

Returns all contacts whose BOOL_000 value is Y OR IndexedBoolean0 value is N

>

(greater than)

<ListOfContact><Contact
searchspec="[IndexedNumber0] > '500'">
<ContactFirstName/>
<IndexedNumber0/>
</Contact></ListOfContact> 

Returns all contacts whose IndexedNumber0 value is greater than 500

>=

(greater than or equal to)

<ListOfContact><Contact
searchspec="[IndexedNumber0] >= '500'">
<ContactFirstName/>
<IndexedNumber0/>
</Contact></ListOfContact> 

Returns all contacts whose IndexedNumber0 value is greater than or equal to 500

<

(less than)

<ListOfContact><Contact
searchspec="[IndexedNumber0] < '500'">
<ContactFirstName/>
<IndexedNumber0/>
</Contact></ListOfContact> 

Returns all contacts whose IndexedNumber0 value is less than 500

<=

(less than or equal to)

<ListOfContact><Contact
searchspec="[IndexedNumber0] <= '500'">
<ContactFirstName/>
<IndexedNumber0/>
</Contact></ListOfContact> 

Returns all contacts whose IndexedNumber0 value is less than or equal to 500

<>

(not equal to)

<ListOfContact><Contact
searchspec="[IndexedNumber0] <> '500'">
<ContactFirstName/>
<IndexedNumber0/>
</Contact></ListOfContact> 

Returns all contacts whose IndexedNumber0 value is not equal to 500