Select to view content in your preferred language

Set the proprety "MaxFeatures" of QueryParameters catch a exception

939
2
06-12-2017 12:30 AM
xiaoguangyan
Emerging Contributor

When I set QueryParameters.MaxFeatures then execute ServiceFeatureTable.QueryFeaturesAsync(QueryParameters parameters, QueryFeatureFields queryFeatureFields) then will catch a exception(Unable to complete operation.), but don't set it codes go well, Anyone can help this? Thank in advance

Tags (1)
0 Kudos
2 Replies
JenniferNery
Esri Regular Contributor

When you create QueryParameter, do you set one of these properties: WhereClause, Geometry, ObjectIds? At least one of these is required by the service. Or do you only set MaxFeatures?

I'm not able to reproduce with the following code unless I remove setting of WhereClause, then I'll get this error as expected.

{"error":{"code":400,"message":"Unable to complete operation.","details":["Unable to perform query operation."]}}
        public MainWindow()
        {
            InitializeComponent();

            
            MyMapView.Map = new Map(Basemap.CreateStreets());
            MyMapView.Map.OperationalLayers.Add(new FeatureLayer(new Uri("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/0")));
        }
        private async void OnClick(object sender, RoutedEventArgs e)
        {
            var table = (ServiceFeatureTable)((FeatureLayer)MyMapView.Map.OperationalLayers[0]).FeatureTable;
            var query = new QueryParameters() { WhereClause = "1=1" };
            query.MaxFeatures = 50;
            var results = await table.QueryFeaturesAsync(query, QueryFeatureFields.LoadAll);
        }
0 Kudos
xiaoguangyan
Emerging Contributor

Hi Jennifer 

I have set the WhereClause.

0 Kudos