Select to view content in your preferred language

Use letter instead of integer as subtype field/code

1001
3
02-15-2024 10:18 AM
Status: Open
Labels (1)
Bud
by
Esteemed Contributor

ArcGIS Pro 3.2.2

A subtype can only be created using an integer field, not a text field: 

image (4).png

Create and manage subtypes

You cannot create subtypes if there are no available integer fields to use as the subtype field. If this is the case and you want to create subtypes, open the Fields view and add an integer field on which to base the subtypes.

When using a table that has a subtype in a SQL Expression or other scripts (database view, Python, etc.), we only see the integer codes, not the textual descriptions. The integers are difficult to work with since there's no way to know what the number pertains to, without investigation.

Related: @MErikReedAugusta in Best practices with using domains?

I abhor the numeric-code-with-text-alias approach to Domains.

I'm aware that it's possible to bring subtype descriptions into a script by adding extra logic. But it's a nuisance to and adds extra complexity (for example, Select subtype and a subtype field's domain names using SQL). And that doesn't help us with SQL Expressions in Pro like Select By Attributes or definition queries (when writing SQL, not using the query builder). 

I'd rather just have subtype codes that are meaningful, such as:

  • R | Road
  • S | Sidewalk
  • B | Bridge

Could subtypes be enhanced to allow letters as codes, not just integers?

3 Comments
Kevin_MacLeod

I always use same text on both sides. This would be key, to support text.  (so 0, 1, 2 doesn't end up in stuff, for example Views not supporting domains, in third party apps, making def queries more sane, etc)

MErikReedAugusta

Absolutely seconded!! (or fourthed, as the case may be, going by the current Kudos?)

 

I have OFTEN railed against this artificial limitation with our own data.  To be fair, I'm sure there could be many datasets out there for which this would be an untenable memory sink.

But to be equally fair, there are plenty of datasets for which it's not.  Let us make that call as users and schema designers, because we know our data.

LanceKirby2

Throwing my vote in here!