query.orderByFields bug

2496
3
Jump to solution
02-19-2014 08:00 AM
StevenHaslemore
Occasional Contributor
After applying the ArcGIS Server 10.1 Quality Improvement Patch we're getting errors on queries using the orderByFields parameter.

query.outSpatialReference = map.spatialReference;
query.returnGeometry = false;
query.outFields = ["*"];
query.where = "1=1";
query.orderByFields = ["OBJECTID"];

The js api encodes this into the request as
orderByFields=OBJECTID  <-- FAILS  with "{"error":{"code":400,"message":"Unable to complete operation.","details":[]}}"

Running the same query through the rest service explorer results in that parameter being encoded as
orderByFields=["OBJECTID"]   <--- WORKS

I can confirm our endpoint table Supports Advanced Queries and I have tested this against the latest api version.
Is there another query parameter that I'm missing?
0 Kudos
1 Solution

Accepted Solutions
JeffPace
MVP Alum
After applying the ArcGIS Server 10.1 Quality Improvement Patch we're getting errors on queries using the orderByFields parameter.

query.outSpatialReference = map.spatialReference;
query.returnGeometry = false;
query.outFields = ["*"];
query.where = "1=1";
query.orderByFields = ["OBJECTID"];

The js api encodes this into the request as
orderByFields=OBJECTID  <-- FAILS  with "{"error":{"code":400,"message":"Unable to complete operation.","details":[]}}"

Running the same query through the rest service explorer results in that parameter being encoded as
orderByFields=["OBJECTID"]   <--- WORKS

I can confirm our endpoint table Supports Advanced Queries and I have tested this against the latest api version.
Is there another query parameter that I'm missing?


Terrible work around but have you tried

query.orderByFields = ["[\"OBJECTID\"]"];

View solution in original post

0 Kudos
3 Replies
JeffPace
MVP Alum
After applying the ArcGIS Server 10.1 Quality Improvement Patch we're getting errors on queries using the orderByFields parameter.

query.outSpatialReference = map.spatialReference;
query.returnGeometry = false;
query.outFields = ["*"];
query.where = "1=1";
query.orderByFields = ["OBJECTID"];

The js api encodes this into the request as
orderByFields=OBJECTID  <-- FAILS  with "{"error":{"code":400,"message":"Unable to complete operation.","details":[]}}"

Running the same query through the rest service explorer results in that parameter being encoded as
orderByFields=["OBJECTID"]   <--- WORKS

I can confirm our endpoint table Supports Advanced Queries and I have tested this against the latest api version.
Is there another query parameter that I'm missing?


Terrible work around but have you tried

query.orderByFields = ["[\"OBJECTID\"]"];
0 Kudos
StevenHaslemore
Occasional Contributor
Terrible work around but have you tried

query.orderByFields = ["[\"OBJECTID\"]"];


Very sneaky, the old sting that looks like an array inside an array trick, it works!
0 Kudos
JeffPace
MVP Alum
im a hack, i almost dont want credit for that!!!

Glad it worked, make sure you comment it well in your code so when it changes back in the next version you can find it quickly and revert 🙂
0 Kudos