Does anyone knows of a way to control numeric format for DOUBLE or FLOAT values using only arcpy outside of ArcGIS Pro? I would like to find any ways to control the allowed number of decimals and also the thousand separator. As of now, I have explored two options :
1. Specifying the scale of the field when creating a new field using the "AddField" function, but I found out that the "scale" and "precision" parameters are ignored when using on a feature class inside a geodatabase.
2. Using the layer CIM to access the numberFormat properties with the following script, but the fieldDescriptions list always return empty. After reading a bit on the problem, this seems more like a feature than a bug (eventhough I don't get why we cannot acces the list in a python script, bu we can in the python command promt, inside ArcGIS Pro).
aprx_path = [PATH_TO_APRX]
aprx = arcpy.mp.ArcGISProject(aprx_path)
map = aprx.listMaps()[0]
lyr = map.listLayers("MyLayer")[0]
lyr_cim = lyr.getDefinition('V3')
for fd in lyr_cim.featureTable.fieldDescriptions:
fdNumFmt = fd.numberFormat
fdNumFmt.useSeparator = True
fdNumFmt.roundingValue = 2 So here I am, stuck...
Please help!
Thanks!