ArcGIS API for Silverlight - Library Reference
Text Property
See Also  Send comments on this topic
ESRI.ArcGIS.Client.Tasks Namespace > Query Class : Text Property

Shorthand literal search on the text for the 'Display Field' that is specified by the ArcGIS Server feature service.

Syntax

Visual Basic (Declaration) 
Public Property Text As String
C# 
public string Text {get; set;}

Remarks

The 'Display Field' is the default field in an ArcGIS Server feature service used to return attribute value for features. The Query.Text Property is acts very similar to a LIKE operator in SQL programming for the 'Display Field'. The Query.Text Property is shorthand for the where clause of:

            where <DisplayField> like '%<Query.Text>%'
            

The string that is specified for the Query.Text Property is case sensitive.

The Query.Text Property is ignored if the Query.Where Property is specified.

The only special wildcard characters that can be used in the Query.Text string are: '%' and '_'. The '%' character means any string of zero or more characters. The '_' character means any single character.

The other LIKE wildcard characters that are common in many SQL language variants cannot be used in the Query.Text Property; specifically: '[]' and '[^]'.

You can discover what the 'Display Field' is using the ArcGIS Services Directory. Copy the Url of the desired ArcGIS Server into the address bar of a web browser:

Using the ArcGIS Service Directory Diagram 1.

Then click on the desired MapServer or FeatureServer hyperlink (you may need to traverse some folders if the feature service is nested in a hierarchy):

Using the ArcGIS Service Directory Diagram 2.

Then click on a sub-layer; it will have its integer ID value in parenthesis:

Using the ArcGIS Service Directory Diagram 3.

Towards the top of the page you should see the 'Display Field' section that lists the name of the default attribute field that is used by the feature service.

Using the ArcGIS Service Directory Diagram 4.

For example using the FeatureService Url of: http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/5 The following table provides several examples strings in the Query.Text Property and the features returned:

Query.Text value Features found
"New" 4 features found: New Hampshire, New York, New Jersey, New Mexico.
"NEW" 0 features found.
"new" 0 features found.
"or" 7 features found: North Dakota, New York, California, Colorado, North Carolina, Georgia, Florida.
"or%i" 4 features found: California, North Carolina, Georgia, Florida
"or_i" 2 features found: California, Georgia

The Text Property is one of the minimum Properties that must be set in order to have a valid Query object for use in a QueryTask operation. The number-of and combination-of Properties that need to be set in the Query object order to obtain valid results from a QueryTask's execution vary widely. The queries can be spatial, textual, or a combination of two. At a minimum at least one of the following Query Properties must be used in order to obtain valid results from a QueryTask:

If none of the above listed Query Properties are used, then an error message similar to the following will be returned in the QueryTask.Failed Event:

'Error code '400': 'Unable to complete operation.'
'where' parameter not specified
'objectIds' parameter not specified
'time' parameter not specified
'geometry' parameter not specified
'text' parameter not specified
'Unable to complete Query operation.

The other Properties on the Query class may also be necessary to augment the spatial or textual query to obtain the results desired. When setting multiple spatial or textual Query Property values (those listed in the bulleted list above) they act and as an 'AND' type of condition for retrieving results from the feature service. This means that only those features that meet the conditions of both these spatial/textual queries will be returned in the FeatureSet. The number of combinations that can be used to filter which data is returned is nearly limitless.

NOTE: ** Query.Text and Query.Where are the only exceptions to this rule of setting both of these Query Properties acting as an 'AND'. When these two properties are both set, the Query.Where Property take precedence and the Query.Text Property is ignored!

Requirements

Target Platforms: Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows 7

See Also

© ESRI, Inc. All Rights Reserved.