8

Anyone who has worked with numbers that have more than 14 digits has run into ArcMap's wonderful habit of converting any number of such length to e-notation. While changing this is a simple matter of going into the Field Properties and setting the number format, doing this repeatedly for every field in every table grows tiresome. Is there some secret environment setting or method to make number formats default to something besides "Numeric"?

5
  • Are you looking for a programmatic solution ? May 4 '11 at 15:37
  • I'm just looking for a -solution-. Chances are that an ArcObjects one is outside of my scope, however, unless it's an already-built AddIn.
    – Nathanus
    May 4 '11 at 15:44
  • @Kirk After digging in to ArcObjects a little bit in the past week, it seems that the INumberFormat interface is only useful for changing the way the field displays when you use valuetostring and stringtovalue methods. Is this the case, or will it actually adjust the way it is seen in the table in ArcMap?
    – Nathanus
    May 31 '11 at 15:28
  • Sorry, you should be able to cast it to INumericFormat. May 31 '11 at 17:08
  • This is generally a database limitation (15) and not specific to ArcGIS, putting that aside, is it a Short, Long, Double or a Float?
    – CDBrown
    Sep 22 '11 at 0:47
4

As best as I can tell, the answer is no, one can't set the default number format, not without programming (and for that one would start with INumericFormat as noted by Kirk. See example for Decimal Degree Angle Radian and Currency Format).

Also the numeric display property is stored in the map (.mxd) or layer file (.lyr) and not a property if the table itself, so any changes made interactively or via the programming like the above won't apply to new data. Changing the field numeric type at creation time to doublem, float, etc. won't help either, for the same reason (it's not a field or table property).

Presumably this means the only way forward is to hope someone builds and shares a "change numeric format for all selected layers" button in Arcmap, and/or post a feature request to http://ideas.arcgis.com and hope the powers that be decide it's worth implementing as a user preference.

3

I found next solution:

Carto.FeatureLayer class implements Geodatabase.ITableFields and Geodatabase.ILayerFields interfaces. Via one of these two interfaces you can access FieldInfo property type of Geodatabase.IFieldInfo. Then use IFieldInfo.NumberFormat property.

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.