Select to view content in your preferred language

Assign default value to GPFeatureRecordSetLayer parameter

199
3
2 weeks ago
sbrowneotogo
New Contributor

Hello,

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(
    name='input_parcels',
    displayName='Input Parcels',
    datatype='GPFeatureRecordSetLayer',
    parameterType='Required',
    direction='Input'
)

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

 

0 Kudos
3 Replies
sbrowneotogo
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
AlfredBaldenweck
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
sbrowneotogo
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