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
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);
}
Hi Jennifer
I have set the WhereClause.