Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

How do I get list of fields from feature class/shapefile using tool?

$
0
0
I'm making a custom tool that will allow the user to make many different changes to the fields of a chosen feature class or shapefile.

Part of my code is:

Code:

fc = arcpy.GetParameterAsText(0)
And then when I create the tool parameters I choose the Data Type as Data Element.

The next input I get from the user is the field from the fc that they want to use to copy data from into a new field.

Code:

copy_field = arcpy.GetParameterAsText(1)
For this parameter I've tried Field, Field Info and Field Mappings but none of them give me the fields of the inputted fc.

How can I link this parameter to the first one to give me a list of the fields within the fc?

Viewing all articles
Browse latest Browse all 2485

Trending Articles