Following Pan gis's suggestion, after running the Remove Domain From Field tool from the ArcToolbox in ArcMap, I clicked on the Geoprocessing tab, then copied the Results as a Python snippet. This will show how ArcMap populates the tool's parameters.
arcpy<SPAN class="punctuation token">.</SPAN>RemoveDomainFromField_management<SPAN class="punctuation token">(</SPAN>in_table<SPAN class="operator token">=</SPAN><SPAN class="string token">"PW_Conduit_Wire"</SPAN><SPAN class="punctuation token">,</SPAN> field_name<SPAN class="operator token">=</SPAN><SPAN class="string token">"FLOOR_ID"</SPAN><SPAN class="punctuation token">,</SPAN> subtype_code<SPAN class="operator token">=</SPAN><SPAN class="string token">"'1: Earth NET';'2: ELTW';'3: LTW';'4: Conduit'"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
After checking the ListSubtypes documentation, I came up with the following code which should remove the domains from the features using subtypes.
<SPAN class="keyword token">import</SPAN> arcpy gdb <SPAN class="operator token">=</SPAN> r<SPAN class="string token">'C:\Path\To\COBW_Power.gdb'</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> gdb domains <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="string token">'CD_Level'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'CD_FittingDiameter'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'CD_FittingMaterial'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'CD_Diameter'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'CD_Material'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'CD_Ownership'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'CD_Parcel ID'</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="keyword token">for</SPAN> fds <SPAN class="keyword token">in</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListDatasets<SPAN class="punctuation token">(</SPAN><SPAN class="string token">''</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'Feature'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">print</SPAN> <SPAN class="string token">"DS: {}"</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>fds<SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">for</SPAN> fc <SPAN class="keyword token">in</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListFeatureClasses<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"*"</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">""</SPAN><SPAN class="punctuation token">,</SPAN>fds<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">print</SPAN> <SPAN class="string token">"\tFC: {}"</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>fc<SPAN class="punctuation token">)</SPAN> subtypes <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>ListSubtypes<SPAN class="punctuation token">(</SPAN>fc<SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># loops through feature class' subtypes one at a time</SPAN> <SPAN class="keyword token">for</SPAN> stcode<SPAN class="punctuation token">,</SPAN> stdict <SPAN class="keyword token">in</SPAN> list<SPAN class="punctuation token">(</SPAN>subtypes<SPAN class="punctuation token">.</SPAN>items<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">for</SPAN> stkey <SPAN class="keyword token">in</SPAN> list<SPAN class="punctuation token">(</SPAN>stdict<SPAN class="punctuation token">.</SPAN>keys<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="comment token"># if there is a Subtype Field (that is, it is not an empty string)</SPAN> <SPAN class="keyword token">if</SPAN> <SPAN class="operator token">not</SPAN> stdict<SPAN class="punctuation token">[</SPAN><SPAN class="string token">'SubtypeField'</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">==</SPAN> <SPAN class="string token">''</SPAN><SPAN class="punctuation token">:</SPAN> st_code <SPAN class="operator token">=</SPAN> <SPAN class="string token">"'{}: {}'"</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>stcode<SPAN class="punctuation token">,</SPAN> stdict<SPAN class="punctuation token">[</SPAN><SPAN class="string token">'Name'</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">if</SPAN> stkey <SPAN class="operator token">==</SPAN> <SPAN class="string token">'FieldValues'</SPAN><SPAN class="punctuation token">:</SPAN> fields <SPAN class="operator token">=</SPAN> stdict<SPAN class="punctuation token">[</SPAN>stkey<SPAN class="punctuation token">]</SPAN> <SPAN class="keyword token">for</SPAN> field<SPAN class="punctuation token">,</SPAN> fieldvals <SPAN class="keyword token">in</SPAN> list<SPAN class="punctuation token">(</SPAN>fields<SPAN class="punctuation token">.</SPAN>items<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="comment token"># if field has a domain</SPAN> <SPAN class="keyword token">if</SPAN> <SPAN class="operator token">not</SPAN> fieldvals<SPAN class="punctuation token">[</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="keyword token">is</SPAN> None<SPAN class="punctuation token">:</SPAN> <SPAN class="comment token"># and the domain is in our list</SPAN> <SPAN class="keyword token">if</SPAN> fieldvals<SPAN class="punctuation token">[</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>name <SPAN class="keyword token">in</SPAN> domains<SPAN class="punctuation token">:</SPAN> <SPAN class="comment token"># delete the domain</SPAN> <SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"\t\t{} domain deleted from field {} in subtype {}"</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>fieldvals<SPAN class="punctuation token">[</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>name<SPAN class="punctuation token">,</SPAN> field<SPAN class="punctuation token">,</SPAN> st_code<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>RemoveDomainFromField_management<SPAN class="punctuation token">(</SPAN>in_table<SPAN class="operator token">=</SPAN>fc<SPAN class="punctuation token">,</SPAN> field_name<SPAN class="operator token">=</SPAN>field<SPAN class="punctuation token">,</SPAN> subtype_code<SPAN class="operator token">=</SPAN>st_code<SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">print</SPAN> <SPAN class="string token">"Done."</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
My previous code should remove the remaining domains from features not using subtypes.
=====
Edit: After some additional thought, here is a version that will remove domains from fields whether using subtypes or not. Basically, I added an else on line 21 to pass RemoveDomainFromField a "#" if the feature doesn't use a domain. The indentation, starting at line 23, was changed as a result.
<SPAN class="keyword token">import</SPAN> arcpy gdb <SPAN class="operator token">=</SPAN> r<SPAN class="string token">'C:\Path\To\COBW_Power.gdb'</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> gdb domains <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="string token">'CD_Level'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'CD_FittingDiameter'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'CD_FittingMaterial'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'CD_Diameter'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'CD_Material'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'CD_Ownership'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'CD_Parcel ID'</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="keyword token">for</SPAN> fds <SPAN class="keyword token">in</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListDatasets<SPAN class="punctuation token">(</SPAN><SPAN class="string token">''</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'Feature'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">print</SPAN> <SPAN class="string token">"DS: {}"</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>fds<SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">for</SPAN> fc <SPAN class="keyword token">in</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListFeatureClasses<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"*"</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">""</SPAN><SPAN class="punctuation token">,</SPAN>fds<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">print</SPAN> <SPAN class="string token">"\tFC: {}"</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>fc<SPAN class="punctuation token">)</SPAN> subtypes <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>ListSubtypes<SPAN class="punctuation token">(</SPAN>fc<SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># loops through feature class' subtypes one at a time</SPAN> <SPAN class="keyword token">for</SPAN> stcode<SPAN class="punctuation token">,</SPAN> stdict <SPAN class="keyword token">in</SPAN> list<SPAN class="punctuation token">(</SPAN>subtypes<SPAN class="punctuation token">.</SPAN>items<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">for</SPAN> stkey <SPAN class="keyword token">in</SPAN> list<SPAN class="punctuation token">(</SPAN>stdict<SPAN class="punctuation token">.</SPAN>keys<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="comment token"># if there is a Subtype Field (that is, it is not an empty string)</SPAN> <SPAN class="keyword token">if</SPAN> <SPAN class="operator token">not</SPAN> stdict<SPAN class="punctuation token">[</SPAN><SPAN class="string token">'SubtypeField'</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">==</SPAN> <SPAN class="string token">''</SPAN><SPAN class="punctuation token">:</SPAN> st_code <SPAN class="operator token">=</SPAN> <SPAN class="string token">"'{}: {}'"</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>stcode<SPAN class="punctuation token">,</SPAN> stdict<SPAN class="punctuation token">[</SPAN><SPAN class="string token">'Name'</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># if no Subtype Field, use "#" in RemoveDomainFromField for subtype_code</SPAN> <SPAN class="keyword token">else</SPAN><SPAN class="punctuation token">:</SPAN> st_code <SPAN class="operator token">=</SPAN> "<SPAN class="comment token">#"</SPAN> <SPAN class="keyword token">if</SPAN> stkey <SPAN class="operator token">==</SPAN> <SPAN class="string token">'FieldValues'</SPAN><SPAN class="punctuation token">:</SPAN> fields <SPAN class="operator token">=</SPAN> stdict<SPAN class="punctuation token">[</SPAN>stkey<SPAN class="punctuation token">]</SPAN> <SPAN class="keyword token">for</SPAN> field<SPAN class="punctuation token">,</SPAN> fieldvals <SPAN class="keyword token">in</SPAN> list<SPAN class="punctuation token">(</SPAN>fields<SPAN class="punctuation token">.</SPAN>items<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="comment token"># if field has a domain</SPAN> <SPAN class="keyword token">if</SPAN> <SPAN class="operator token">not</SPAN> fieldvals<SPAN class="punctuation token">[</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="keyword token">is</SPAN> None<SPAN class="punctuation token">:</SPAN> <SPAN class="comment token"># and the domain is in our list</SPAN> <SPAN class="keyword token">if</SPAN> fieldvals<SPAN class="punctuation token">[</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>name <SPAN class="keyword token">in</SPAN> domains<SPAN class="punctuation token">:</SPAN> <SPAN class="comment token"># remove the domain</SPAN> <SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"\t\t{} domain removed from field {} using subtype {}"</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>fieldvals<SPAN class="punctuation token">[</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>name<SPAN class="punctuation token">,</SPAN> field<SPAN class="punctuation token">,</SPAN> st_code<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>RemoveDomainFromField_management<SPAN class="punctuation token">(</SPAN>in_table<SPAN class="operator token">=</SPAN>fc<SPAN class="punctuation token">,</SPAN> field_name<SPAN class="operator token">=</SPAN>field<SPAN class="punctuation token">,</SPAN> subtype_code<SPAN class="operator token">=</SPAN>st_code<SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">print</SPAN> <SPAN class="string token">"Done."</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Thanks @RandyBurton
super useful.
David
Dear Randy Burton,
Thank you so much i really appreciate your help.
Thanks
Santhosh
Hi Santhosh,
by using the tool "Remove domain from field", when a layer with subtypes is input, you get a list of the subtypes, first select all of the subtypes and then choose the field name you want to clear from domains.
The domain will be cleared from all the subtypes.
Then, if your domains are assigned to many fields: either you repeat the GP selecting another field or write a script, export this tool into a scriptand see how it works the script and then loop through a list of field (but I am not the right person for helping in doing so.)
Taking Python out of the equation....did you try simply executing the GP Tool in ArcGIS Desktop?
It's working remove domain from field but see the image number 2. I want remove domain from each subtype field.
Since you are working with feature datasets, the loop should start with ListDatasets. I added a few lines to Mitch Holley's code.
<SPAN class="keyword token">import</SPAN> arcpy gdb <SPAN class="operator token">=</SPAN> r<SPAN class="string token">'C:\Path\To\COBW_Power.gdb'</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> gdb domains <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="string token">'CD_Level'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'CD_FittingDiameter'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'CD_FittingMaterial'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'CD_Diameter'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'CD_Material'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'CD_Ownership'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'CD_Parcel ID'</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="keyword token">for</SPAN> fds <SPAN class="keyword token">in</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListDatasets<SPAN class="punctuation token">(</SPAN><SPAN class="string token">''</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'Feature'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">print</SPAN> <SPAN class="string token">"{}"</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>fds<SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">for</SPAN> fc <SPAN class="keyword token">in</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListFeatureClasses<SPAN class="punctuation token">(</SPAN><SPAN class="string token">''</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">''</SPAN><SPAN class="punctuation token">,</SPAN>fds<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">print</SPAN> <SPAN class="string token">"\t{}"</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>fc<SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">for</SPAN> field <SPAN class="keyword token">in</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListFields<SPAN class="punctuation token">(</SPAN>fc<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">if</SPAN> field<SPAN class="punctuation token">.</SPAN>domain <SPAN class="keyword token">in</SPAN> domains<SPAN class="punctuation token">:</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>RemoveDomainFromField_management<SPAN class="punctuation token">(</SPAN>fc<SPAN class="punctuation token">,</SPAN>field<SPAN class="punctuation token">.</SPAN>name<SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">print</SPAN> <SPAN class="string token">"\t\t{} domain removed from field {}."</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>field<SPAN class="punctuation token">.</SPAN>domain<SPAN class="punctuation token">,</SPAN> field<SPAN class="punctuation token">.</SPAN>name<SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">print</SPAN> <SPAN class="string token">"Done."</SPAN> <SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
From your images, it looks like you are not indenting the remove domain and print lines correctly. Python us very particular oabout indentation. Take a look at the code posted by mitchh300 again.
It will depend upon, how you had applied the Domain initially.
You cannot remove Domains from fields, which have been assigned under the Subtype tab of the Feature Class properties.
Any domain, assigned under the Fields tab...those can be removed using the tool.
Dear Holley,
See the below images, it's not removed for domains.
<SPAN class="keyword token">import</SPAN> arcpy database <SPAN class="operator token">=</SPAN> r<SPAN class="string token">'...path to database...'</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> database domains <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="string token">'CD_Level'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'CD_FittingDiameter'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'CD_FittingMaterial'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'CD_Diameter'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'CD_Material'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'CD_Ownership'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'CD_Parcel ID'</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="keyword token">for</SPAN> feature <SPAN class="keyword token">in</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListFeatureClasses<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">for</SPAN> field <SPAN class="keyword token">in</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListFields<SPAN class="punctuation token">(</SPAN>feature<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">if</SPAN> field<SPAN class="punctuation token">.</SPAN>domain <SPAN class="keyword token">in</SPAN> domains<SPAN class="punctuation token">:</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>RemoveDomainFromField_management<SPAN class="punctuation token">(</SPAN>feature<SPAN class="punctuation token">,</SPAN>field<SPAN class="punctuation token">.</SPAN>name<SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">print</SPAN> <SPAN class="string token">"%s domain removed."</SPAN><SPAN class="operator token">%</SPAN>str<SPAN class="punctuation token">(</SPAN>field<SPAN class="punctuation token">.</SPAN>domain<SPAN class="punctuation token">)</SPAN> <SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
I'm a little unclear on your ultimate objective here. You can easily remove a domain from a field. You can also delete the domain from the geodatabase, which also removes it from all fields it was assigned. I also wrote a script that will delete unused domains from a geodatabase.
EDIT:
Possible duplicate post with https://community.esri.com/thread/198383-how-to-assign-domain-to-field-for-gdb
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.