I created a custom geoprocessing tool using Python in ArcGIS Pro and published it to use in Web AppBuilder. The results show with no issues in ArcGIS Pro, however, in Web AppBuilder, they don't, I believe the issue has to do with not specifying the output parameter correctly.
My issue now is how would I specify the output parameter to be the same as the input parameter? I added the arcpy.env.overwriteOutput = True and I did set the output parameter to be derived. But when I run the tool, it doesn't give me any errors and it tells me that the results are drawn on the map, but the changes are not implemented.
Not too sure what I'm doing wrong.
Here's my Python script:
arcpy.env.overwriteOutput = True
#Inputs
Point1 = arcpy.GetParameterAsText(0)
Point2 = arcpy.GetParameterAsText(1)
Polygon = arcpy.GetParameterAsText(2)
#Outputs
out1 = arcpy.SetParameter(3, Point1)
out2 = arcpy.SetParameter(4, Point2)
# Select points that overlap the polygon
selected_points = arcpy.SelectLayerByLocation_management(Point1, 'INTERSECT',
Polygon)
#Append selected points to the other layer.
arcpy.Append_management(selected_points, Point2, 'NO_TEST')
#Deelete selected points from the original layer
arcpy.DeleteFeatures_management(selected_points)
Solved! Go to Solution.
Thank you very much for your reply! I just republished the geoprocessing tool and it worked, I don't know what I did wrong when I told you it didn't work.
One last question, I want to specify a specific feature in the polygon layer by specifying the objectid value, I tried to do the following script, again, it works in ArcGIS Pro but it doesn't in WAB. Do you have an idea what could be the issue?
Specified_Polygon is a Result object not a FeatureLayer. Use Specified_Polygon = arcpy.SelectLayerByAttribute_management(etc...)[0] or arcpy.SelectLayerByAttribute_management(etc...).getOutput(0)
Oh, I get it now. Thank you very much!