I discovered a weird issue with the results of the Identify widget.
Two of my identify layers are FEATURE layers and one is a MAP layer. Unless the MAP layer is above both of the feature layers in the widget they won’t show the domain descriptions (instead they show the coded values). Additionally, if I remove the MAP layer from the identify widget, and only have the two FEATURE layers, both are still incorrectly showing the coded domain values not the correct domain description.
Does anyone know why this is?
Jason
Solved! Go to Solution.
Jason,
OK. I found the issue in my widget. I have never encountered a feature type that has an inherited domain. Normally feature types have the domain values listed in that particular feature type. Anyway here is the fix.
In the identify Widget.js file find and overwrite this function:
_getCodedValue: function (layer, fieldName, fieldValue, typeID) {
var result;
var codedValueDomain;
if (typeID) {
var featureType = this._getFeatureType(layer, typeID);
if (featureType) {
codedValueDomain = featureType.domains[fieldName];
}
} else {
var field = this._getField(layer, fieldName);
if (field) {
codedValueDomain = field.domain;
}
}
if (codedValueDomain) {
if(codedValueDomain.type === 'codedValue'){
for (var cv = 0; cv < codedValueDomain.codedValues.length; cv++) {
var codedValue = codedValueDomain.codedValues[cv];
if (fieldValue === codedValue.code) {
result = codedValue;
break;
}
}
}else if(codedValueDomain.type === 'inherited'){
var field = this._getField(layer, fieldName);
if (field) {
codedValueDomain = field.domain;
if(codedValueDomain.type === 'codedValue'){
for (var cv = 0; cv < codedValueDomain.codedValues.length; cv++) {
var codedValue = codedValueDomain.codedValues[cv];
if (fieldValue === codedValue.code) {
result = codedValue;
break;
}
}
}
}
}
}
return result;
},
Jason,
This is something I will have to look into. Is you app public where I can test against it?
Unfortunately it isn't but I can get you a temp set of credentials to test it. What would be the best way to send those to you?
Jason,
It will be next week before I can take a look, but you can hover over my name and message me (not that I am following you).
No worries. I just sent you the credentials and link. Have a great weekend!
Jason Stanton, GISP
GIS/IT Director, Montachusett Regional Planning Commission
464 Abbott Avenue
Leominster, MA 01453
Phone: 978.798.6164
Fax: 978.348.2490
Email: jstanton@mrpc.org<mailto:jstanton@mrpc.org>
Please be advised that the Massachusetts Secretary of State considers e-mail to be a public record, and therefore subject to the Massachusetts Public Records Law, M.G.L. c. 66 § 10.
When testing, the community value for the trails and point of interest should be a name not a number.
Jason,
OK. I found the issue in my widget. I have never encountered a feature type that has an inherited domain. Normally feature types have the domain values listed in that particular feature type. Anyway here is the fix.
In the identify Widget.js file find and overwrite this function:
_getCodedValue: function (layer, fieldName, fieldValue, typeID) {
var result;
var codedValueDomain;
if (typeID) {
var featureType = this._getFeatureType(layer, typeID);
if (featureType) {
codedValueDomain = featureType.domains[fieldName];
}
} else {
var field = this._getField(layer, fieldName);
if (field) {
codedValueDomain = field.domain;
}
}
if (codedValueDomain) {
if(codedValueDomain.type === 'codedValue'){
for (var cv = 0; cv < codedValueDomain.codedValues.length; cv++) {
var codedValue = codedValueDomain.codedValues[cv];
if (fieldValue === codedValue.code) {
result = codedValue;
break;
}
}
}else if(codedValueDomain.type === 'inherited'){
var field = this._getField(layer, fieldName);
if (field) {
codedValueDomain = field.domain;
if(codedValueDomain.type === 'codedValue'){
for (var cv = 0; cv < codedValueDomain.codedValues.length; cv++) {
var codedValue = codedValueDomain.codedValues[cv];
if (fieldValue === codedValue.code) {
result = codedValue;
break;
}
}
}
}
}
}
return result;
},
Robert,
That worked, partially. I'm noticing that the "Community" field (and many others) is now correct but others (such as "Trail Status" and "Data Methodology" are still not working. I checked to be sure they were setup the same and they are.
Additionally, I'm noticing that the results are not replacing null (they are correctly nulled out) with an empty string.
Jason,
OK. I think I found fixes for those as well: (lines 6-8 are new) this code block is in the showQueryResults function in the Widget.js
if (cArr[0] === currentLayer.typeIdField) {
var featureType = this._getFeatureType(currentLayer, typeID);
if (featureType && featureType.name) {
value = featureType.name;
}
if (featureType && featureType.templates && featureType.templates.length > 0) {
value = featureType.templates[0].name;
}
} else {
For the null issue search for these lines
if(this.replacenullswithemptystring && (value === 'Null' || value === '<Null>')){
value = '';
}
and replace with
if(this.replacenullswithemptystring && (value === 'Null' || value === 'null' ||value === '<Null>')){
value = '';
}
Should be four instances of it.
That did it, thank you very much!