Object reference not set to an instance of an object
Hi all,
I've got a fairly simple workflow set up with a query task to get records from a mapservice, return the results and zoom to the extent of the selected features. I'm running into the following error when trying to run it in my application:
Alert
There was a workflow error running activity: Exception has been thrown by the target of an invocation.
Workflow 'ZoneSearch' failed.
Unhandled exception: 'Object reference not set to an instance of an object.' in activity '1.9: Set Map Extent'.
Object reference not set to an instance of an object.
-The SetMapExtent is the final activity in the workflow.
-The Input Argument is extent.Expand(3)
-extent is an input Variable Type: Envelope Scope: Flowchart. It is also the result of the GetFeatureSetExtent activity (which comes before SetMap Extent.
My apologies for the complicated explanation - its really difficult to explain the issue without being able to add screen shots to the post.
0
-
Does your FeatureSet contain geometry (Return Geometry is True on the Query Task)?
Are there features in the FeatureSet (FeatureSet.Features.Any should return True)
If you FeatureSet contains one point feature: a point has no extent.
Does your FeatureSet return features (Return OIDs Only is False).
Check the contents of the FeatureSet with the .ToJson method.0 -
Thanks for the reply Nico,
Hopefully I can cover all of your points:
1. QueryTask...Return Geometry = True
2. QueryTask goes through a Flow Decision Node (FeatureSet.Features.Count = 0)0 -
Argh, sorry I can't seem to end my post and i posted too early...
2. QueryTask goes through a Flow Decision Node (FeatureSet.Features.Count = 0)
if True return No Features Found
if False Select FeaturesSet
3. The input feature class is a polygon only. No points.
4. Can you elaborate on using the .ToJson method to check the contents of the FeatureSet?
Thanks again0 -
.ToJson returns a json representation of the featureset, you can use an alert activity to show the contents. 0 -
Okay - great, the contents of the FeatureSet makes sense (contains the the correct information for the correct mapservice). 0 -
There is geometry in it? Because the issue should be in the geometry. 0 -
Hi Nico - you were absolutely correct. The geometry was not coming across (The SHAPE@ fields were not visible in the ArcGIS Pro project that publishes the map service) So, that explains why the query task was able to return tabular information but returning a null value for geometry and then bombing when trying to get the extent info.
Thanks for you help. The .ToJSON method was very helpful in debugging the issue.0 -
The OBJECTID is correctly filled? 0 -
yes and the error appears when in the buffer tool, 0 -
and when I drop the alert message I got the result. 0 -
Set Return Geometry on the Query Task to True. 0 -
Thank you Nico for your help, it is already set to true, I could confirm that the issue is resolved by entering the service url instead of the layer url. This was my silly mistake! 0
Please sign in to leave a comment.
Comments
12 comments