After my ArcMap extension executes the Identity tool, the resulting identity shapefile has FID columns for the "input features" FeatureClass and the "identity features" FeatureClass but the column names get cut off. I need to access these columns when looping through the identity shapefile later.

I thought I could find the field by name to get the column index but I never know what they are going to be called. It is "FID_" plus some part of the input's name but the column name string is too short to just compare the strings. The inputs might have similar names.

If I do this manually in ArcMap, it does not cut off the names. The column name will be 'FID_" plus the full name of the input feature FeatureClass name.

Is there a way to set what the FID column names will be?


Firstly, I don't think there is a way to specify what the 'FID_' field will be called because it is automatically generated. However, you could make your own field before the identity operation and copy your FID values to it. That way you can effectively control the name of a field you can search on later. You'll also get the 'FID_' field but can now ignore it.

Remember that shapefiles have short limits on the field name lengths. Geodatabases can have longer field names, so another alternative would be to use the geodatabase format instead of shapefiles

  • I wasn't aware of the different field name lengths until now, thanks. I ended up creating a geodatabase to save the output to instead of the shapefile. – thelastlombax Feb 21 '12 at 5:08
  • The Shapefile is a rather old format and based on the DBF files format it shares its limitations for field names. – MappaGnosis Feb 21 '12 at 10:39

I have previously used IFieldChecker, among other scenarios, to determine what column names are going to be after running geoprocessing tools. IFieldChecker.Validate also returns list of fixed fields, which will have their names shortened (and possibly numbered) if required by the target workspace.

Remember you also need to set the field checker's workspaces correctly, see the linked documentation. If you use shapefile workspace as the ValidateWorkspace, you'll get different result than with e.g. a file geodatabase or SDE, since name length limits differ between them.

You will need to duplicate some of the tool's logic, namely joining the field names, and provide that names to the field checker. Once you do that, however, you'll be able to see what the cut off names will look like in the shapefile.

If you see different results in ArcMap, it is probably because you are using a geodatabase, as opposed to shapefiles in your ArcObjects code.

  • I will use IFieldChecker and a geodatabase instead of a shapefile in the future. – thelastlombax Feb 21 '12 at 5:11

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.