How to add your knowledge

Domains

    Table of contents
    1. 1. Domains
    2. 2. Domain Values
    3. 3. Domain Relations

    Domains

    User-defined attributes can be created using common data types, such as numbers or strings. They can also be limited to a specified enumeration of values. A list of possible values such an attribute can have is called a “domain.” Each domain corresponds to a single table in the database. Domains are created using the Structure.AddDomainTable() method.

    Note

    Domain tables automatically have suffix “_TBD” attached to them.

    The following line creates a “DEMO_MAINTENANCE_TYPE_TBD” domain:

    AddDomainTable(
        "DEMO_MAINTENANCE_TYPE_TBD", 
        "DEMO MAINTENANCE TYPE"); 
    

    Domain Values

    Values within a domain are added individually. The following code adds three new values to the DEMO_MAINTAINENANCE_TYPE_TBD domain: “u”, “o”, and “tbd”:

    AddDomainEntry("DEMO_MAINTENANCE_TYPE_TBD", 
       1, 
       "unknown", 
       "u", 
       "description", 
       true);
     
    AddDomainEntry("DEMO_MAINTENANCE_TYPE_TBD", 
       10000, 
       "other", 
       "o", 
       "description"
       true);
     
    AddDomainEntry("DEMO_MAINTENANCE_TYPE_TBD", 
       10001, 
       "to be determined", 
       "tbd", 
       "description"
       true);
    

    Domain Relations

    A domain relationship is used to set a particular attribute to use the defined domain. The following line sets the ID_MAINTENANCE_TYPE attribute of the DEMO_MAINTENANCE feature class to use the DEMO_MAINTENANCE_TYPE_TBD domain:

    AddRelationToDomain(
        "DEMO_MAINTENANCE_TYPE_TBD", 
        "DEMO_MAINTENANCE", 
        "ID_MAINTENANCE_TYPE");
    

    Now an ID_MAINTENANCE_TYPE attribute can hold one of three values: “u”, “o”, or “tbd”.