Query layer not returning distinct values
?SupportsAdvanced Queries on the layer is set to true and using ArcGISServer10.3. Also set 'return geometry' to false in the query layer activity.
Anyone got any ideas ?
-
Hey Greg,
I'm having similar issues with returning distinct values.
I suspect that you aren't able to use the return distinct values if you're using a geometry for your query, because I was able to get it to work when I only supplied the query layer with:
URL
Where
Return Geometry = false
Output Fields
Return Distinct Values = true
But when I try it on some of my other similar queries that use a Geometry instead of a Where clause it doesn't work.
At first my query wasn't working though because I didn't have a token in my URL.
0 -
Hi Odiri,
I've set Return geometry = false but the return distinct values is still not working.
What I've worked out is that if I use a geometry picker to define an area in the Query Layer (Return geometry = false) and try to return distinct values for the defined geometry it doesn't work but if I don't use a geometry picker it returns distinct values no problems.
URL
Where
Geometry=$form1.state.geometryPicker1.value.geometry[0]
Output Fields COMNAME
Return Distinct Values = true
In the old workflow I used to define a geometry and then return distinct values all the time so I'm wondering if this is a bug ?
Regards
Greg
0 -
In Odiri's case it might have to do with the with the backing database for ArcGIS Server. I've been told that SQL Server cannot do distinct queries when the returned information includes a geometry. Some of our LA County demo services fail to do this as well (pardon the long url here):
But in Greg's case, it doesn't sound like we're meeting those conditions. Greg, are you able to use your browser tools to watch your network traffic at the time this query is sent by the workflow (F12 + switch to network tab while running the workflow)?
You could take the query url from there, change f=json to f=html, and troubleshoot on the ArcGIS Server REST endpoint. We could try to figure out if ArcGIS Server has a reason for not handling the query, or if the workflow has formatted the request incorrectly somehow.
0 -
Hi Amanda
I've ?played around with the query url on the REST endpoint but everything looks OK to me (except for the result). I tested it on several different layers and the result was always the same; distinct records returned if no geometry defined (ie just an attribute query) but as soon a geometry was specified then no distinct results.
Here's a url that you could look at and test if you want. It's meant to return an unique list of fauna species for selected geometry
When I run it I get the following result
# records: 7
COMNAME: Bush Stonecurlew
COMNAME: Black-winged Currawong (KI)
COMNAME: Superb Fairywren
COMNAME: Southern Brown Bandicoot (SA mainland and KI)
COMNAME: Southern Brown Bandicoot (SA mainland and KI)
COMNAME: Red Wattlebird (KI)
COMNAME: Spotted Pardalote
Thanks for your help
regards
Greg
0 -
Hi
Just wondering if anyone has been able to return unique values from an area selected using the geometry picker ?
Regards
Greg?
0 -
Just thought I'd summarize what I've worked out with regards to returning distinct values when a geometry is defined,
- If map service is created from a file geodatabase the query works fine
- if map service is created from our ESRI Enterprise Geodatabase (oracle) then distinct values are not returned. The 'ReturnDistinctValues' switch is ignored.
0 -
I had to specify exactly one field in the "Output Fields" property, then only unique values were returned. My workflow doesn't include any type of geometry picker, I am just a referring to a query task.
0 -
@Greg Wilkins? Did you ever figure out why when using an ESRI Enterprise Geodatabase (Oracle) that switch is ignored? I am trying to do the same thing and I am not getting distinct results returned.
@Amanda Frech? Do you know if this is a bug? If so, is there another way around this?
0 -
To Clarify.....from the REST Endpoint, if I run the same query I get distinct values. But when run through the Workflow it does not return distinct values.
0 -
when I enter one field here, it works, but not if more than one field is returned
0 -
@Christopher Wiebke? Thanks for you feedback. I have only one field as the output field (TOWN), I have return geometry set to "False" and I have set the Return Distinct Values to 'True". My where clause is "1=1". It returns all records.
On the server the Supports Advanced Queries is true.
If I run this same query from the REST endpoint from ArcServer it works as expected. If I use this query in a query tool in workflow to set the values of a drop down list it does not work and returns all values when looking at the query through the developer tools. It's very odd to me. Just wondering if I am the only one...
0 -
I am not using 1=1 for my where clause. I am using: =`ProjectNumber LIKE '${$textReplace1.result}%'` where textReplace1.result is carried over from the get form event data activity and the text replace activity (basically, the formatted values the user starts to type from the auto complete box)
0 -
This is similiar to what is provided in the sample auto-complete workflow
0 -
I do wonder if there is a bug though, I don't know why it only works when exactly one field is given. I don't remember it being that way in workflow 4.
0 -
@Ali VanSickle? I'd use the browser tools (F12 > Network tab) to check the exact request that the workflow is sending to ArcGIS Server, and the compare that meticulously to the one that works when you test it in a browser. There is probably some difference between the requests, even if the same properties were selected/used on each one. Maybe even use WinMerge (or similar) to highlight the differences
0 -
@Amanda Frech? Thanks!
I looked at the requests and for some reason the request is not adding the returnDistinctValues parameter:
http://cabot1:6080/arcgis/rest/services/CanoeServices/Operational_Property/MapServer/3/queryf=json&where=1%3D1&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=TOWN&orderByFields=TOWN
But if I look at the console tab and look at the request it does have it in there:
- gcx:wf:arcgis:query:QueryTask ($query3) --> {inputs: {…}, outputs: {…}}
- inputs:
- orderByFields: "TOWN"
- outFields: "TOWN"
- returnDistinctValues: "True"
- returnGeometry: "False"
- spatialRelationship: "intersects"
- url: "http://cabot1:6080/arcgis/rest/services/CanoeServices/Operational_Property/MapServer/3"
- where: "1=1"
- inputs:
Any ideas as to why it would be stripping out this parameter in the request being made?
0 - gcx:wf:arcgis:query:QueryTask ($query3) --> {inputs: {…}, outputs: {…}}
Du måste logga in om du vill lämna en kommentar.
Kommentarer
16 kommentarer