I'm trying to create a drop down menu in a Python script in ArcMap where one input is a CSV and the other input is a drop down of the headers in that CSV. Is this possible at all?
In the image above, "Candidate List" is the supplied CSV and "Candidate Field" is the field header that the user selects for the column that the data is located in. Would I have to put something in the script its self or in the update parameters?
with open(Candidate List, "rb") as f:
reader = csv.reader()
i = reader.next()
Wherein I want I to be the fields for that drop down.
Best Answer
It is definitely possible. You would need to use script tool validation class.
csv
orpandas
, for instance).With
csv
:With
pandas
:updateParameters
to set values of the needed parameter to the list of columns.Code:
Please look up the help page for more examples. Another helpful answer is here.