Query non-feature tables using ArcGIS Runtime SDK for .NET?

2226
1
03-17-2016 04:37 PM
AndrewFoster
New Contributor II

Is it possible to query non-feature tables using the ArcGIS Runtime SDK for .NET 10.2.7?

I have a native Windows app using a file geodatabase (.gdb) as the source for an ArcGISDynamicMapServiceLayer hosted by a LocalMapService.  I want to query a non-feature table in the ArcGISDynamicMapServiceLayer.  I can retrieve a list of the tables from AllLayersServiceInfo.Tables and execute a FindTask the same way as I can with feature layers but the FindResult.Results.Count is always 0.  I've verified the FindParameters match an existing record in the table.  I've tried using the QueryTask but the results are the same.

1 Reply
AndrewFoster
New Contributor II

Yes Andrew, you can query a non-spatial table using the ArcGIS Runtime SDK for .NET.  Whether your data source is an online map service or a local map service, you must use the QueryTask to query a table.  The table does not have to be related to a feature layer but must be included in the map service layer definition.  Interrogate the AllLayersServiceInfo.Tables collection to find the ID of the desired table.  Then, append the table ID to the end of the map service Url when creating the Uri object for the QueryTask.  Using the Query object, you specify the search criteria (WHERE clause) targeting the table.  You follow the same procedure to query a single feature layer after you discover its layer ID.  Here's the main difference between the FindTask and the QueryTask: The FindTask is used to search for a single attribute value on one or more fields in one or more feature layers using the FindParameters.LayerIDs list property and the FindParameters.SearchFields list property.  The QueryTask is used to search a single feature layer -or- table by appending the feature/table ID to the map service Uri and using a query string that acts as a WHERE clause.