Cannot apply coded domain to float type field in enterprise GDB

4149
4
08-05-2015 12:52 PM
AllWeatherHeather
Occasional Contributor

I have an existing feature class in an enterprise geodatabase with a float field. I would like to add a coded domain to limit the options a user has when performing data entry. Specifically, I want a coded domain so that the users will see 4.3 m (14ft) in the dropdown and 4.3 will be applied to the field as a value.

When I set up the domain I choose field type Float and set my codes and descriptions without any problems, click Apply, OK, I'm happy. When I try to go back into Database Properties a moment later (without applying the domain to any fields) the Field type has now changed to Double. When I try to change it back to Float I get an error "The existing domain field type does not match that of the updated domain".

Side note: I have followed the steps above and was able to successfully apply a domain to a float field in a file geodatabase.

Can anyone help me out? Is this a limitation of an enterprise gdb?

Thanks,

Heather

0 Kudos
4 Replies
XanderBakker
Esri Esteemed Contributor

May have something to do with the differences between databases in the definition of field types...

ArcGIS field data types—ArcGIS Help | ArcGIS for Desktop

0 Kudos
JeffreySwain
Esri Regular Contributor

I think this has to do with the potential values in a float data range.  Just like you cannot create an attribute table on a raster with 32 bit float bit depth. The number of potential rows that could be added are too high and the software will prevent you from doing this operation. When you turn the floating point values into an integer, then you can access it. Perhaps your database is preventing the error that would otherwise occur and forcing it into another field type.  I haven't tested this, but the behavior is probably expected.

GavinMcGhie
Occasional Contributor

Did you ever resolve this issue? Contrary to the explanation above about too many rows in the table, fields and domains of type DOUBLE seem to work just fine. My understanding is that the only difference between FLOAT and DOUBLE is number of characters, so logically FLOAT (smaller) should work if DOUBLE works. I'm really not wanting to convert all my fields to DOUBLE to make this work!

0 Kudos
NeilEtheridge
New Contributor III

This is thread has been inactive for a while but though I'd share my recent experience in case it is useful.  I have created a number of "Float" type domains via python and successfully applied them to Float type fields (ArcGIS Desktop 10.2.1 - SQL Server hosted geodatabase).  However when viewing the values in these fields in ArcMap the code would display rather than the description.  And in the ArcFM Attribute Editor the values would display with square brackets and hightlight red as an invalid value.  Viewing the domain in ArcCatalog the domain type was showing as Double.

Digging in the bowels of the geodatabase in the sde.gdb_items table you can find the XML definition of the domain.

SELECT [Definition]
  FROM [Electricity].[sde].[GDB_ITEMS] where name like 'Distribution Transformer Bottom Tap'

Here you can observe the coded values have been created as a type of double rather than float.

<FieldType>esriFieldTypeDouble</FieldType>
...
...
 <CodedValue xsi:type="typens:CodedValue">
 <Name>2</Name>
 <Code xsi:type="xs:double">2</Code>
 </CodedValue>

If you cut and paste the definition to a text editor, replacing esriFieldTypeDouble with esriFieldTypeSingle and xs:double with xs:float you can reapply it to the database to update the definition.

UPDATE 
    sde.gdb_items 
SET
    definition = '<GPCodedValueDomain2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:typens="http://www.esri.com/schemas/ArcGIS/10.1" xsi:type="typens:GPCodedValueDomain2"><DomainName>Distribution Transformer Bottom Tap</DomainName><FieldType>esriFieldTypeSingle</FieldType><MergePolicy>esriMPTDefaultValue</MergePolicy><SplitPolicy>esriSPTDuplicate</SplitPolicy><Description>Distribution Transformer Bottom Tap</Description><Owner>ARCFM</Owner><CodedValues xsi:type="typens:ArrayOfCodedValue"><CodedValue xsi:type="typens:CodedValue"><Name>Unknown</Name><Code xsi:type="xs:float">-9999</Code></CodedValue><CodedValue xsi:type="typens:CodedValue"><Name>Other</Name><Code xsi:type="xs:float">-9997</Code></CodedValue><CodedValue xsi:type="typens:CodedValue"><Name>1</Name><Code xsi:type="xs:float">1</Code></CodedValue><CodedValue xsi:type="typens:CodedValue"><Name>2</Name><Code xsi:type="xs:float">2</Code></CodedValue><CodedValue xsi:type="typens:CodedValue"><Name>3</Name><Code xsi:type="xs:float">3</Code></CodedValue><CodedValue xsi:type="typens:CodedValue"><Name>4</Name><Code xsi:type="xs:float">4</Code></CodedValue><CodedValue xsi:type="typens:CodedValue"><Name>5</Name><Code xsi:type="xs:float">5</Code></CodedValue><CodedValue xsi:type="typens:CodedValue"><Name>6</Name><Code xsi:type="xs:float">6</Code></CodedValue><CodedValue xsi:type="typens:CodedValue"><Name>7</Name><Code xsi:type="xs:float">7</Code></CodedValue><CodedValue xsi:type="typens:CodedValue"><Name>8</Name><Code xsi:type="xs:float">8</Code></CodedValue><CodedValue xsi:type="typens:CodedValue"><Name>9</Name><Code xsi:type="xs:float">9</Code></CodedValue><CodedValue xsi:type="typens:CodedValue"><Name>10</Name><Code xsi:type="xs:float">10</Code></CodedValue></CodedValues></GPCodedValueDomain2>'
WHERE
    type = '8C368B12-A12E-4C7E-9638-C9C64E69E98F' AND
	name = 'Distribution Transformer Bottom Tap'‍‍‍‍‍‍‍

After this update the field and domain performs correctly inside ArcMap and you can add additional values to the domain via ArcCatalog.

I'm sure this falls in the category of a hack and totally unsupported ... but works.

Testing creation of a domain in ArcCatalog under 10.7.1 suggests this has been fixed in a post 10.2.1 release.  I was able to specify a Float domain and have it stay a Float domain.

0 Kudos