1

I have a python script tool (arcpy) in a standard toolbox that edits data in fields, but I want some code in tool validation that would make sure that when the user gets to the field parameter, the check box list of fields will never contain OID or geometry.

How might that look in the tool validation code? I have almost no experience tool validation code by the way. I have no code because I don't know what this would look like.

2

You can achieve this by setting the parameters appropriately, without any validation code at all. I'll use an example Script Tool with two parameters: FC (set as type "Feature Class"), and Fields (set as type "Field"; "MultiValue"=Yes; "Obtained from"=FC).

The critical step is then to set the filter as "Field", which should open a new window where you can uncheck boxes of certain data types -- in your case, OID and Geometry. The screenshot below should make this all clear.

Script Properties and Field filter windows

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.