value list parameter

339
3
04-15-2020 02:33 AM
StuartMoore
Occasional Contributor III

is there a python toolbox parameter type which allows the user to paste in a list of values (ie copy the list from excel and paste into the parameter)

thanks

Stu

0 Kudos
3 Replies
DanPatterson_Retired
MVP Esteemed Contributor

The parameter 'dependency' can be set to provide things like field names from a featureclass, but I haven't seen anything that dynamically allows you to copy and paste from excel

RandyBurton
MVP Regular Contributor

My initial response would be to use the 'File' data type with a filter of 'xls; xlsx', so the user can select the file.  Then the tool validator section can read the file and load the values into a parameter for the user to select from.

Alternatively, you could code a relative path to the Excel file in tool validator section.  This may have benefits or issues depending on the project.

StuartMoore
Occasional Contributor III

thanks both for the replys, in the end i pasted the data into a text file, created a parameter with the data type of 'DETextfile' and used that.

the toolbox i wanted to create was a select by attribute tool that could select thousands of features based on the list i pasted into the text file.

the tool works by reading the text file into a list and then looping through it in batch's of 10 lines and selects the features and then moves onto the next 10 lines and adds them to the already selected features.

thanks

Stu

0 Kudos