ESRI.ArcGIS.ADF.IMS
WhereExpression Property
See Also 
ESRI.ArcGIS.ADF.IMS.Carto.Layer Namespace > SelectionBuffer Class : WhereExpression Property




Gets or sets the where clause for selecting objects in a target layer.

Syntax

Visual Basic (Declaration) 
Public Property WhereExpression As String
Visual Basic (Usage)Copy Code
Dim instance As SelectionBuffer
Dim value As String
 
instance.WhereExpression = value
 
value = instance.WhereExpression
C# 
public string WhereExpression {get; set;}

Example

For an example, see the SelectionBuffer overview.

Remarks

This WhereExpression filters the features in the TargetLayer that are selected by the SelectionBuffer.

  • The following operators work in a WhereExpression: =, >, >=, <, <=, <>, LIKE, BETWEEN, IN, NOT IN.
  • The following are not valid: ORDER BY and DISTINCT.
  • When creating a WhereExpression, two fields from the same attribute table can be used for comparison. For example, a query can be made to find states with a female population greater than the male population.

    WhereExpression="COUNTRY.STATE.FEMALES &gt; COUNTRY.STATE.MALES"

Querying with dates - Image Services

The syntax for querying dates is the same regardless of the locale. A date query uses the following syntax:

{ts 'YYYY-MM-DD hh:mi:ss'}

where

YYYY Year Required Use four digits for the year.
MM Month (01-12) Required Use two digits for the month. March is 03.
DD Day (01-31) Required Use two digits for the day. The fourth is 04.
hh Hour (00-23) Optional Use a 24-hour clock. 8 a.m. is 08, and 8 p.m. is 20.
mi Minutes (00-59) Optional Use two digits for the minutes. If minutes is used, hours must also be included.
ss Seconds (00-59) Optional Use two digits for the seconds. If seconds is used, hours and minutes must also be included.

The year, month, and day are each separated by a dash (-). The hour, minutes, and seconds are each separated by a colon (:). The date is enclosed in single quotes (') inside curly brackets ({}). Before the date, ts (for time stamp) must be included.

For 8:03:23 a.m. January 4, 2000, the query on a DBF file looks like:

WhereExpression="MYDATE = {ts '2000-01-04 08:03:32'}"

For 9:18 p.m. March 8, 2002, the query on an ArcSDE layer looks like:

WhereExpression="ARCSDE.TABLE.MYDATE = {ts '2002-03-08 21:18:00'}"

Querying with dates - ArcMap Image Services.

A date query uses the same syntax as you would use in ArcMap. The format differs depending on the data type that the map is referencing:

Dates in coverages, shapefiles and ArcSDE geodatabases comply with SQL standards. The following example searches for January 31, 2003:

WhereExpression="DATE_ = date '2003-01-31' "

Dates in personal geodatabases are delimited like the following example:

WhereExpression="[DATE_] = #2003-01-31# "

Native database supported date formats may also be used when working with ArcSDE geodatabases

See Also

© 2010 All Rights Reserved.