Supprimer un domaine (Outils de gestion des données)
Résumé
Supprime un domaine d’un espace de travail.
Utilisation
Il est impossible de supprimer un domaine s’il est associé à une table ou une classe d’entités. Utilisez l’outil Supprimer un domaine d’un champ pour supprimer l’association entre une classe d’entités ou une table et un domaine.
Vous pouvez également gérer les domaines dans la vue Domains (Domaines), qui s‘ouvre en cliquant sur le bouton Domains (Domaines) dans le groupe Design (Création) du ruban Data (Données).
Exemple 2 d’utilisation de la fonction DeleteDomain (script autonome)
Ce script autonome utilise la fonction DeleteDomain dans le cadre d’un processus destiné à mettre à jour un domaine.
# Name: RemoveDomainsExample.py
# Purpose: Update an attribute domain to constrain valid pipe material values
# Import system modules
import arcpy
import os
# Set the workspace (to avoid having to type in the full path to the data every time)
arcpy.env.workspace = "data"
# set local parameters
inFeatures = "Montgomery.gdb/Water/DistribMains"
inField = "MATERIAL"
dWorkspace = "Montgomery.gdb"
domName = "Material"
codedValue = "ACP: Asbestos concrete"
codeField = "TYPE"
descField = "DESRIPT"
# Process: Remove the constraint from the material field
arcpy.management.RemoveDomainFromField(inFeatures, inField)
# Edit the domain values
# Process: Remove a coded value from the domain
arcpy.management.DeleteCodedValueFromDomain(dWorkspace, domName, codedValue)
# Process: Create a table from the domain to edit it with standard editing tools
arcpy.management.DomainToTable(dWorkspace, domname,
os.path.join(dWorkspace, domname), codeField,
descField)
# Process: Delete the domain
arcpy.management.DeleteDomain(dWorkspace, domName)
# Edit the domain table outside of geoprocessing
# and then bring the domain back in with the TableToDomain process