Select to view content in your preferred language

Assign default value to GPFeatureRecordSetLayer parameter

06-08-2024 08:56 AM
New Contributor


I've created a python toolbox that allows a user to select geometries on a map as input to the tool. It works, except even after assigning a value as I am here, when I run the tool it still has a dropdown of map layers with none selected by default. Am I doing something wrong in assigning the value of the parameter?

input_parcels = arcpy.Parameter(
    displayName='Input Parcels',

aprx ='Current')
mp = aprx.listMaps('Map')[0] 
lyr = mp.listLayers('parcel_shapefiles')[0]
input_parcels.value = lyr


0 Kudos
3 Replies
New Contributor

What on earth are you talking about? I use a "proper IDE" and it doesn't raise any warnings or errors. If all you're doing is commenting to show your contempt and can't even provide useful feedback on how to solve the issue, you shouldn't be commenting.

0 Kudos
MVP Regular Contributor

Hi, this is weird.

I just tested it myself and had the same thing happen. Interestingly enough, if you change it to GPFeatureLayer, the default runs no problem.

So, I'm not sure of your workflow, but if you don't need the interactivity, maybe try GPFeatureLayer instead?

0 Kudos
New Contributor

Thanks for checking on your end - I might reach out to ESRI tech support to see if it's a bug. Unfortunately the interactive element is a hard requirement. It isn't a huge deal, because it just means the user needs to select from the drop down as an extra step, I just wanted to make it more seamless and avoid the potential for user error.

0 Kudos