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

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...