Select to view content in your preferred language

How to validate FeatureClass names?

604
2
08-27-2022 03:21 AM
JR99
by
Occasional Contributor

ArcPy has the function ValidateTableName to remove invalid characters.

Summary

Takes a table name and a workspace path and returns a valid table name for the workspace. An underscore "_" will replace any invalid character found in the table name and will honor the name restrictions for the workspace. The table name restrictions depend on the specific RDBMS used.

 

Is there a similar function to clean a table name for .NET?

Or is there a list of all invalid characters and words?

I need a way to ensure users don't enter invalid characters when entering a layer name.

0 Kudos
2 Replies
Aashis
by Esri Contributor
Esri Contributor

I don't think SDK has a method to validate table names.

However, here are some chars that make the table/feature class name invalid - white space( ), dot (.), dash(-), @, &, * , etc.

The table name restrictions depend on the specific RDBMS used.

0 Kudos
JR99
by
Occasional Contributor

Thanks for the reply but I was hoping for an answer that was a bit more definative.

I'm using the default geodatabase and whilst I've written my own function to remove non-alpha numeric characters and prevent the table name beginning with a numeral, I was hoping there was somthing inbuilt since the documentation is lacking sufficient explanation on the table naming rules.

0 Kudos