Query Layer with Out Statistics example?
I have not been able to get the Query Layer activity to work correctly with an Out Statistics input parameter. I can run the query directly on the REST endpoint and get a result, but not through workflow.
It appears the the REST endpoint adds a + after each : in the geometry and outStatistics. That doesn't happen in the workflow query.
REST endpoint query that works directly:
I have also tried using the Send Web Request, but I get the same result (no features). Anybody else have a working Out Statistics example working?
--Marc
-
Hi Marc,
Which client application are you running the workflow in?
Thanks, Stefan
0 -
Hi Stefan,
Currently just testing in the sandbox. It will be in the GVH if it works.
--Marc
0 -
Hi Marc,
I'm sorry to hear this isn't working for you. Which viewer are you using?
Looking at the typescript version, for both 3.x and 4.x we expect the "Out Statistics" property to be an object (or array of objects) with these properties:
- onStatisticField
- outStatisticFieldName
- statisticType
Here is an example of typical values.
We then pass it to the QueryTask which performs the actual request behind the scenes.
0 -
I should have looked at your example before responding. I see you already have the right three fields in your example that works.
I would expect you should be able to specify the following expression to get the equivalent behaviour from a workflow:
Out Statistics
=[{ statisticType: "avg", onStatisticField: "ann_wef", outStatisticFieldName: "Average" }]
?
0 -
The Out Statistics input is not supported in Geocortex Mobile:
https://docs.geocortex.com/workflow/latest/help/Default.htm#wf5/help/activities/query-task.htm
(Scroll to the Supported Environments section at the end.)
0 -
Yeah, this is what I have:
=[{"statisticType":"avg","onStatisticField":"ann_wef","outStatisticFieldName":"Average"}]
It looks like it might be related to adding a geometry to the query. If I remove the geometry input, I do get a value for the statistics.
I see in the geocortex docs that:
If Out Statistics is specified, the only other properties that will be used are Group By Fields For Statistics, Order By Fields, Text, Time Extent, and Where.
Do you know why geometry is not used? The ArcGIS REST API supports it?
Marc
0 -
Hi Marc,
You should be able to use this as the input value for the Out Statistics parameter:
=[{"statisticType": "avg","onStatisticField": "ann_wef","outStatisticFieldName": "Average"}]
Is there an error displayed in the console logs when you run with this configuration?
Thanks, Stefan
0 -
@Stefan Schweigert?
I think our posts crossed. No error, just no returned features if I include the geometry input. Trying to see if I can get a Send Web Request version to work around the Query Layer not including the geometry based on the geocortex docs.
0 -
So interestingly, I can create a Send Web Request that works IF I pass in a hardcoded geometry value not one tied to an object created in workflow: Example Set Web Request Json input parameters that does work:
```
={
"geometry":{"rings":[[[-13842707.603927674,5417130.413083111],[-13853179.47680273,5417665.472281107],[-13853179.47680273,5418009.438908389],[-13853179.47680273,5418888.464733668],[-13853103.039774444,5419194.212846808],[-13853026.602746159,5419538.17947409],[-13852873.728689589,5420187.894214514],[-13851765.391779454,5421984.164379213],[-13849739.8105299,5423971.527114625],[-13848172.851450056,5424391.930770193],[-13846032.614658074,5424086.182657053],[-13843357.318668097,5421831.290322643],[-13842707.603927674,5417665.472281107],[-13842707.603927674,5417130.413083111]]],"spatialRefernce":{"wkid":102100,"latestWkid":3857}},
"geometryType":"esriGeometryPolygon",
"spatialRel":"esriSpatialRelIntersects",
"returnGeometry":true,
"returnTrueCurves":false,
"outStatistics":[{"statisticType": "avg","onStatisticField": "ann_wef","outStatisticFieldName": "Average"}],
"returnZ":false,
"returnM":false,
"returnDistinctValues":false,
"returnExtentsOnly":false,
"f":"pjson"
}
```
0 -
But if I do a get Geometry from JSON activity with the same input and then put that in the geometry in the input, it doesn't work. Since the idea is that the geometry would be provided from the user drawn area, it would need to be dynamic.
0 -
Does the geometry work without Out Statistics? Maybe there's something not quite right about the geometry object.
I double-checked the code, and despite the description to the contrary, using the Out Statistics input does not affect what we do with the rest of the inputs. We still set any that were supplied. It's possible this description was added due to how the REST API worked at the time, but that's just a guess.
0 -
Okay, I was able to get the dynamic geometry working. Not exactly sure what the difference was in the formatting, but with a test geometry picker geometry output (first of the array) entered in the above parameters, I was able to get the statistics to return as expected. Must have been some format issue. Thanks for your help!
Marc
0 -
You're welcome! Glad to hear you got it working.
0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
13 kommentarer