Hi, I am loading the data from a mobile geodatabase, which includes the Utility Network.
I can see the geodatabase contain the field domains. However, I'd like to display the field domain value description, instead of the code in a popup.
Any suggestions ?
Something like this should work:
private static string GetDisplayValue(Field field, Feature feature)
{
if (field is null || feature is null || !feature.Attributes.ContainsKey(field.Name))
return string.Empty;
var value = feature.Attributes[field.Name];
if (field.Domain is CodedValueDomain cvd)
{
value = cvd.CodedValues.FirstOrDefault(c => c.Code == value)?.Name ?? value;
}
return value?.ToString() ?? string.Empty;
}
Thanks @dotMorten_esri . This should work, but unfortunately it doesn't.
cvd.CodedValues.FirstOrDefault(c => c.Code == value)?.Name ?? value;
Still gives me the code, instead of the name. I can see the name is populated when debugging.
Also I need to include Asset Group and Asset Types description.