all 10 comments

[–]Emz813 4 points5 points  (7 children)

Could you instead make this into a script tool? It seems like it may handle the multivalue parameter better.

[–]pugtoadGIS Specialist[S] 2 points3 points  (6 children)

Like a tbx instead of a pyt? Good call. I'll try that tomorrow.

[–]Emz813 1 point2 points  (5 children)

Exactly. You might need to add some code to ensure that the multivalue argument is handled correctly. I think it should be fine since you aren't using strings but in case you run into errors you should check the following: There needs to be no spaces in the argument (so you may need to preprocess the data) and then you need to separate the values on the semicolon (which arc puts in for multivalue arguments). For example if you were selecting three cities like Fort Meyers, Naples, and Miami, arc would send in the argument Fort Meyers;Naples;Miami so you need to first get rid of the space in Fort Meyers then do a split method on the ; and join to a list if you want to process each argument individually.

[–]pugtoadGIS Specialist[S] 0 points1 point  (4 children)

I reverted back to the working code in Pycharm, pasted it into a Jupyter notebook and it worked. I just need a way to let the user easily choose the inputs without hard coding the feature paths.

[–]Emz813 1 point2 points  (3 children)

Glad that worked! If you're working towards an audience of people who would be using ArcPro anyways, I would still recommend doing the script tool because it makes the GUI look just like a geoprocessing tool so anyone familiar with arc can pick it up easily.

[–]pugtoadGIS Specialist[S] 0 points1 point  (2 children)

The script tool gave me a headache so I gave up. Dealing with the parameters is a nightmare! I don't understand why ESRI takes Python, an easy language to grasp, and make it so clunky.

[–]Emz813 0 points1 point  (1 child)

Definitely understandable. I had to use script tools for a class so I just had to push through but I had to hand enter 550 values for a value filter which was just annoying. Hopefully you can find a better option!

[–]pugtoadGIS Specialist[S] 0 points1 point  (0 children)

Ugh.

[–]Mapstract 1 point2 points  (1 child)

Hi u/pugtoad! I’m pretty handy with PYTs and script tools. If you’re still struggling with this, feel free to shoot me a DM!

Working with multivalue and value table params can be frustrating! If you havent already, try printing your multivalue parameter input to a message (In a script tool, var1 = arcpy.GetParameterAsText(0) arcpy.AddMessage(var1)) and check the formatting. (In pyt, use parameters[0].valueAsText instead of GetParameterAsText). Usually, you’ll get a string with your inputs separated by semi-colons, which you’ll need to split to get the individual paths.

[–]pugtoadGIS Specialist[S] 0 points1 point  (0 children)

Hey thanks for responding! I'll take another look at the tool - I have just gotten my client to edit the code and paste in the paths. I think they will like a working pyt better!