フィールドからドメインを削除(Remove Domain From Field) (データの管理)
サマリ
フィーチャクラスまたはテーブル フィールドから属性ドメインの関連付けを解除します。
使用法
- 
このツールで実行される操作内容は、[フィールドへのドメインの割り当て(Assign Domain To Field)] 機能とは正反対です。フィールドからドメインを削除すると、フィールドと属性ドメイン間の関連付けが解除されます。 
- 
フィールドからドメインを削除すると、そのフィールドに対する属性整合性ルールがデータベースから削除されます。 
- 
属性ドメインは、同じテーブル、フィーチャクラス、またはサブタイプの複数のフィールドに関連付けることも、複数のテーブルおよびフィーチャクラスに関連付けることもできます。フィールドからドメインを削除しても、他のドメインの関連付けには影響しません。 
- 
ワークスペース ドメインは、ArcCatalog またはカタログ ウィンドウでも管理できます。[データベース プロパティ] ダイアログ ボックスの [ドメイン] タブを使用して、ドメインを作成および変更できます。 
- 
現在のマップ レイヤを入力テーブルの定義に使用できます。 
- 
[サブタイプ] パラメータの [値の追加] ボタンは、ModelBuilder 専用です。ModelBuilder では、先のツールが実行されていないか、出力データが存在しないために、[サブタイプ] パラメータに値が表示されない場合があります。[値の追加] ボタンを使用して、[フィールドからドメインを削除(Remove Domain From Field)] ダイアログ ボックスに所定の値(1 つまたは複数)を追加して完了した後、モデルの作成を続行できます。 
構文
| パラメータ | 説明 | データ タイプ | 
| in_table | 削除対象の属性ドメインを格納する入力テーブル | Table View | 
| field_name | 属性ドメインとの関連付けが解除されたフィールド | Field | 
| subtype_code [subtype_code,...] (オプション) | 属性ドメインとの関連付けが解除されたサブタイプ コード(1 つまたは複数)を選択します。 | String | 
コードのサンプル
次の Python ウィンドウ スクリプトは、RemoveDomainfromField(フィールドからドメインを削除)関数をイミディエイト モードで使用する方法を示しています。
import arcpy
from arcpy import env 
env.workspace = "C:/data"
arcpy.RemoveDomainFromField_management("montgomery.gdb/water/distribmains", "DIAMETER")
次のスタンドアロン スクリプトでは、RemoveDomainfromField(フィールドからドメインを削除)関数をドメイン編集ワークフローの一部として使用しています。
# Name: RemoveDomainsExample.py
# Purpose: Update an attribute domain to constrain valid pipe material values
# Author: ESRI
# Import system modules
import arcpy, os
from arcpy import env
 
try:
    # Set the workspace (to avoid having to type in the full path to the data every time)
    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.RemoveDomainFromField_management(inFeatures, inField)
 
    # Edit the domain values
    # Process: Remove a coded value from the domain
    arcpy.DeleteCodedValueFromDomain_management(dWorkspace, domName, codedValue)
 
    # Process: Create a table from the domain to edit it with ArcMap editing tools
    arcpy.DomainToTable_management(dWorkspace, domname, dWorkspace + os.sep + domname , codeField, descField)
 
    # Process: Delete the domain
    arcpy.DeleteDomain_management(dWorkspace, domName)
 
    # Edit the domain table outside of geoprocessing
    # and then bring the domain back in with the TableToDomain process
 
except Exception, e:
    # If an error occurred, print line number and error message
    import traceback, sys
    tb = sys.exc_info()[2]
    print "Line %i" % tb.tb_lineno
    print e.message