Select to view content in your preferred language

Can't get the coded values of domain through a feature layer.

3088
4
02-03-2011 07:02 AM
weiliang
Deactivated User
Hi,

I created a feature layer and associated it with a featureDataGrid for attributes edit. One field (field type is text) in this feature layer has domain setting with several coded values. But I can't get the domain values show in the field of this featureDataGrid. And I debug and find that the number of the coded values in this domain setting of the feature layer's field is 0 while debugging. It seems that the domain info is not passed corrected through feature layer.

BTW, by setting up the domain, I can see this domain setting in ArcMap while started editing.

Thanks for your input in advance,

Wei
0 Kudos
4 Replies
JenniferNery
Esri Regular Contributor
I am not sure if you are talking about setting up your service with coded value domain attribute correctly. If so, this might help: http://help.arcgis.com/en/arcgisserver/10.0/help/arcgis_server_dotnet_help/index.html#//0093000000r0...

To know if you have set this up correctly, you can wire up to the FeatureLayer's Initialized event and check for the FeatureLayer's LayerInfo.Fields property. Each field will have these values: http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Field_prop...

FeatureLayer l = sender as FeatureLayer;
foreach (var f in l.LayerInfo.Fields)
{
 if (f.Domain is CodedValueDomain)
 {
  CodedValueDomain cvd = f.Domain as CodedValueDomain;
  foreach (var item in cvd.CodedValues)
  {
   //TODO: check for item.Key and item.Value
  }
 }
}
0 Kudos
weiliang
Deactivated User
Thanks, Jennifer. However, in debug mode by your code method, I can see that domain is assigned to the right field, but there is no codedvalue in this domain.

BTW, do I must create a subtype and then assign this domain to the field? Currently, I don't use subtype for my SDE feature class.

Thanks again,

Wei
0 Kudos
JenniferNery
Esri Regular Contributor
When you visit the FeatureLayer URL from your web browser, do you see coded values similar to this? http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/operations/FeatureServer...

If it is empty there too, then maybe the issue is with your service. I think these are the steps you do for creating a coded value domain: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Creating_a_new_coded_value_domain/001s...
0 Kudos
weiliang
Deactivated User
Thanks, Jennifer. I resolved this issue. It's really good to know that I can monitor the domain coded values in the REST service URL. I just forgot to restart the service after I changed the domain setting.

Have a great afternoon.

Wei

When you visit the FeatureLayer URL from your web browser, do you see coded values similar to this? http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/operations/FeatureServer...

If it is empty there too, then maybe the issue is with your service. I think these are the steps you do for creating a coded value domain: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Creating_a_new_coded_value_domain/001s...
0 Kudos