Friday, 23 March 2018

Validating feature class name in ArcGIS ModelBuilder?


I have a model which creates feature classes based on the value in an attribute (using Iterate Feature Selection). It works fine as long the field values don't have spaces, punctuation marks, etc. but fails otherwise.


I know in a script I can use arcpy.ValidateTableName() to convert "C:\Big Kalzas!" into a name that can be saved, "C__Big_Kalzas_". How does one do the same in a model?


I tried Calculate Value with an expression as simple as arcpy.ValidateTableName("%Field Name%") do defining and calling a function, but it keeps evaluating to 1.


Model diagram, showing expression




No comments:

Post a Comment