Unhandled exception: 'One or more errors occurred.' in activity '1.7: QueryTask'. One or more errors occurred. Failed to execute query.
I'm trying to construct a simple parcel search workflow: My display form uses only an autocomplete box (for the user to enter the MAPNUMER) and a ListBox (to select TAXLOT, with the autocomplete box as the cascading ID) I inserted an alert activity after the DisplayForrm to verify that it's working up to that point, but once it hits the QueryTask activity, I get "Unhandled exception: 'One or more errors occurred.' in activity '1.7: QueryTask'. One or more errors occurred. Failed to execute query."
I believe it has to do with my Where clause which is: String.Format("OBJECTID = '{0}'","resultTaxlotNumber"). If insert any other field name in the place of OBJECTID, the query runs without throwing the error, but I don't get a result.
I have verified the the query operation is supported on the service: http://webmap.co.hood-river.or.us/arcgis/rest/services/PARCELS/MapServer/0
I'm new to this....Please help?
0
-
Hi Mike,
I think the single quotes should be removed.
I tried to run a query and OBJECTID=1 works fine but OBJECTID='1' returns an error: Failed to execute query.
It is related to the type of field so that would explain why using other fields name is not throwing the error.
I hope this helps0 -
Thanks for the quick response, Francesca, but that didn't work either. Your suggestion works when I query in the REST endpoint, but I get the same error when I apply that solution to my workflow.
So still looking for help. I see some folks post up their code...I'm happy to do that if it will help others help me. But I'm sure what I should be posting...is it the workflow file (.xaml), or something else?0 -
hi, Mike,
I would recommend to check what the real request on to the Query Task itself to check your where clause (refer to (https://support.geocortex.com/essentialsGSCkba?sub-nav=kba&main-nav=essentials&feedtype=SINGLE_ARTICLE_DETAIL&criteria=BESTANSWERS&id=kA360000000Cib0CAC) https://support.geocortex.com/essentialsGSCkba?sub-nav=kba&main-nav=essentials&#!/feedtype=SINGLE_ARTICLE_DETAIL&criteria=BESTANSWERS&id=kA360000000Cib0CAC ) how to use the Fiddler to capture it.
Having said that and cheking your parcel service, here is my input for you to do.
1) Parcle layer contains two fields (MAPTAXLOT and TAXLOT) are all esriFieldTypeString, even though TAXLOT value seems to be NUMBER. http://webmap.co.hood-river.or.us/arcgis/rest/services/PARCELS/MapServer/0
2) so your where clause to the Parcel - Query task is supposed to be something like MAPTAXLOT = '01N08E00200' AND TAXLOT = '200' where I used '=' since you arelady use the AutocompleteBox on UI but you are free to construct the WhereClause use LIKE rather than '=', for example, MAPTAXLOT LIKE '%01N08E00200%' AND TAXLOT LIKE '20%', where you need to replace the field values dynamically (see below item 3).
3) On your oringal posting, you write 'String.Format("OBJECTID = '{0}'","resultTaxlotNumber").' on WhereClause, That means "OBJECTID = 'resultTaxNumber'" so it will create a Request object to the QueryTask as http://webmap.co.hood-river.or.us/arcgis/rest/services/PARCELS/MapServer/0/query?where=OBJECTID+%3D+%27resultTaxNumber%27&text=&objectIds=&time=&geometry=&geometryType=esriGeometryEnvelope&inSR=&spatialRel=esriSpatialRelIntersects&relationParam=&outFields=OBJECTID%2C+MAPTAXLOT%2C+TAXLOT&returnGeometry=true&maxAllowableOffset=&geometryPrecision=&outSR=&returnIdsOnly=false&returnCountOnly=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&returnZ=false&returnM=false&gdbVersion=&returnDistinctValues=false&f=html , which returns a error.
Here is my suggestion to do
1) Add Assign: whereClause = String.Format("MAPTAXLOT = '{0}' AND TAXLOT = '{1}'", mapNumberTyped, taxLotTyped), where mapNumberTyped and taxLotTyped are supposed to the variables you declared and assigned to take from UI two controls. You need to change the type of themapNumberTyed though to string.
Finally, your query is suppsoed to be like as an example (you can find from the fiddler) when a user typed mapTextlot as 01N08E00200 and TaxLot as 200
http://webmap.co.hood-river.or.us/arcgis/rest/services/PARCELS/MapServer/0/query?where=MAPTAXLOT+%3D+%2701N08E00200%27+AND+TAXLOT+%3D+%27200%27&text=&objectIds=&time=&geometry=&geometryType=esriGeometryEnvelope&inSR=&spatialRel=esriSpatialRelIntersects&relationParam=&outFields=*&returnGeometry=true&maxAllowableOffset=&geometryPrecision=&outSR=&returnIdsOnly=false&returnCountOnly=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&returnZ=false&returnM=false&gdbVersion=&returnDistinctValues=false&f=html0 -
Thanks Munhwan...I'll try your suggestions and post back! 0
Please sign in to leave a comment.
Comments
4 comments