FieldDomainInfo
A class that represents each unique combination of field and domain for each subtype.
Property |
Type |
Description |
---|---|---|
DefaultValue |
object |
The default value for this field and this subtype. It is used primarily for editing. |
Domain |
The range or coded value domain that contains a range or a set of values valid for the field. | |
FieldName |
string |
The name of the field where the domain is assigned to. |
IsInherited |
bool |
Indicates whether the code description needs to get from the domain assigned at the field level. |
Remarks
Each subtype can also have its own attribute domain for a given field. Domain represents a set of or a range of values valid for a field. Domains can be of two types: (a) range domain or (b) coded domain.
This object contains information about which domain is assigned to which field for which subtype. For example, Domain1 can be assigned to Field1 for Subtype1, while Subtype2 could have Domain2 assigned to the same field Field1.
A domain can be assigned to more than one field in the same subtype or in other subtypes, in such case the domain information may get duplicated. If the same domain is also assigned to the field level, domain information is not duplicated (Domain is null); instead IsInherited is set to True which means that you need to get the domain code description from the domain set at the field level.
DefaultValue is used while adding a new feature or row. When a value is not assigned to a field, the DefaultValue is put in by default.
As name suggests, a range domain sets the minimum and maximum limits of values acceptable for a field. In the above example, a range domain for water pressure can be implemented. The subtype representing "transmission water" mains can have a pressure between 40 and 100 psi, while the subtype for "distribution water" mains can have a pressure between 50 and 75 psi.
While a coded value domain contains a set of distinct valid values for a field. It can apply to any type of attribute; text, numeric, date, and so on, and specifies a valid set of values for an attribute. For example, a coded value list for a text attribute might include valid material values:
- CL: cast iron pipe
- DL: ductile iron pipe
- ACP: asbestos concrete pipe
Or, a coded value list might include the numeric values representing valid diameters:
- .75 = 3/4"
- 2 = 2"
- 24 = 24"
- 30 = 30"
The coded value domain includes both the actual value that is stored in the database (for example, CDL for cast iron pipe) and a description of what the code value means (for example, cast iron pipe).
Examples
C#
//get the service
wsmap.mapservice1_MapServer mapservice = new wsmap.mapservice1_MapServer();
mapservice.Url = "http://srver/ArcGIS/services/mapservice1/MapServer";
//get the server info
string mapname = mapservice.GetDefaultMapName();
MapServerInfo mapinfo = mapservice.GetServerInfo(mapname);
//subtype's field domain information for a layer
//get the layer info from the server info
MapLayerInfo lyrinfo = mapinfo.MapLayerInfos[0];
//get the subtype info
SubtypeInfo[] subtypeinfos = lyrinfo.SubtypeInfos;
if (subtypeinfos.Length > 0)
{
SubtypeInfo subtypeinfo = subtypeinfos[0];
FieldDomainInfo[] flddminfos = subtypeinfo.FieldDomainInfos;
FieldDomainInfo flddmninfo = flddminfos[0];
System.Diagnostics.Debug.WriteLine(flddmninfo.FieldName + ", " + flddmninfo.Domain + ", " + flddmninfo.DefaultValue);
}
//subtype's field domain infomation for a standalone table
//get the standalone table info from the server info if exists
StandaloneTableInfo[] stinfos = mapinfo.StandaloneTableInfos;
if (stinfos != null)
{
//get the subtype info
StandaloneTableInfo stinfo = stinfos[0];
SubtypeInfo[] stsubtypeinfos = stinfo.SubtypeInfos;
SubtypeInfo stsubtypeinfo = stsubtypeinfos[0];
//get the field domain info
FieldDomainInfo[] stflddminfos = stsubtypeinfo.FieldDomainInfos;
FieldDomainInfo stflddminfo = stflddminfos[0];
System.Diagnostics.Debug.WriteLine(stflddminfo.FieldName + ", " + stflddminfo.Domain + ", " + stflddminfo.DefaultValue);
//examine the domain types and values
if (flddmninfo.Domain is MapSrvholistic11.CodedValueDomain)
{
CodedValueDomain codeddomain = (wsmap.CodedValueDomain)flddmninfo.Domain;
CodedValue codedvalue = codeddomain.CodedValues[0];
System.Diagnostics.Debug.WriteLine(codedvalue.Code + ", " + codedvalue.Name);
}
else
{
RangeDomain rangedomain = (MapSrvholistic11.RangeDomain)flddmninfo.Domain;
System.Diagnostics.Debug.WriteLine(rangedomain.MinValue + ", " + rangedomain.MaxValue);
}
}