I want to get the value of an attribute when a user clicks on a feature. Building off this example: https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=tasks-identify. Does anyone know how I can, for example, get the value for DomOrd in the layer Soil Survey Geographic? The following code snippet is from the above example.
if (layerName === 'Soil Survey Geographic') { //the following two lines are similar to what I want, but they don't work var attributeVal = result.layerName.DomOrd; console.log(attributeVal); feature.popupTemplate = { // autocasts as new PopupTemplate() title: "{Map Unit Name}", content: "<b>Dominant order:</b> {Dominant Order} ({Dom. Cond. Order %}%)" + ...
I need to pass the attribute value in an SQL query with ColdFusion - so that's why I need the value.
Here's how to get the value from the field DomOrd. You have to use the field alias to get it
var attributeVal = feature.attributes["Dominant Order"];
console.log(attributeVal);