How to use
See How to use ArcGIS samples for help on compiling, setting up the debugger, and running the sample. If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.
- Start Visual Studio, open the .solution file, and build the project. The Microsoft FlexGrid control (msflxgrd.ocx) is used in this sample.
- Run the application.
- Browse to a PMF (published from ArcMap) to load.
- Select a layer to search.
- Select the type of field to search.
- Select the actual field to search.
- Enter a threshold value and click Query.
Additional information
A simple interface allows you to specify query criteria based on an ARLayer, FieldName, operator, and value. All searchable layers in the map are stored in a Collection or Dictionary object (the Dictionary object in the Visual Basic sample requires a Microsoft Scripting Runtime reference). The Collection or Dictionary object is used to populate a combo box with the ARLayer.Name of the searchable layers. You can select a field to query from the combo box. All fields in the PMF, even those hidden by the publisher in the original map document, will be listed in the combo box. The operators available for use in the query are dependent on IARFeature.FieldType (for example, a greater than operator cannot be used when querying a string FieldType).When you click the Query button, two WhereClause strings are constructed; one selects features that meet the criteria and one selects features that fail the criteria. The WhereClause strings are properties of an ARSearchDef object. ARSearchDef is used with the IARLayer.QueryARFeatures method to return two ARFeatureSet objects. One ARFeatureSet object meets the criteria and one ARFeatureSet object fails the criteria. The nonspatial field attribute information for each ARFeatureSet object is displayed in tabular format in Microsoft FlexGrids using the IARFeature.Value property. For this reason, this sample may be of interest if you are implementing attribute table functionality with the ReaderControl. Each ARFeatureSet can be flashed, zoomed, and centered using the IARFeatureSet.Flash, IARFeatureSet.ZoomTo, and IARFeature.CenterAt methods, respectively.
AttributeQuery.vb | Form file. |
AssemblyInfo.vb | Assembly information. |
AttributeQuery.cs | Form file. |
AssemblyInfo.cs | Assembly information. |
Download the files for all languages
Development licensing | Deployment licensing |
---|---|
ArcView: Publisher | ArcReader |
ArcEditor: Publisher | Engine Runtime |
ArcInfo: Publisher | ArcView |
ArcEditor | |
ArcInfo |