Select to view content in your preferred language

How to clear a subtype field using python

839
4
04-21-2023 07:48 PM
SAMIRMOURAD
Emerging Contributor

Hello,

Is there a function like RemoveDomainFromField but for subtypes ? Or a function that allows us to clear the field of a subtype ? 
Thank you

0 Kudos
4 Replies
DanPatterson
MVP Esteemed Contributor

Do you mean?

Remove Subtype (Data Management)—ArcGIS Pro | Documentation

or are you looking for the new SUBTYPE@ functionality in cursors?

UpdateCursor—ArcGIS Pro | Documentation


... sort of retired...
0 Kudos
SAMIRMOURAD
Emerging Contributor

Let's say that in the exemple below, In Utility Access Type, I would like to remove the link to Domain.
I want to empty the the default value and the domain for AcessType in Utility. I know that I can do it directly on this table, but is there a way of doing it using a pyhton script ?

Thanks

 
 

GUID-8BBDD82A-B8FD-4698-99E2-2498500A408E-web

0 Kudos
SAMIRMOURAD
Emerging Contributor

any suggestions ? 

0 Kudos
JackvanderHorst
New Contributor

https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/remove-domain-from-field.htm

arcpy.management.RemoveDomainFromField(in_table, field_name, {subtype_code})
NameExplanationData Type
in_table

The input table containing the attribute domain that will be removed.

Table View
field_name

The field that will no longer be associated with an attribute domain.

Field
subtype_code
[subtype_code,...]
(Optional)

The subtype code(s) that will no longer be associated with an attribute domain.

String

 

Example:

arcpy.management.RemoveDomainFromField(
    in_table=r"xyz.gdb\UtilityNetwork\ElectricDevice",
    field_name="ASSETTYPE",
    subtype_code="'50: Armatuur'"
)

 

0 Kudos