AnsweredAssumed Answered

Passing attribute value as a variable with ArcGIS JavaScript

Question asked by pattyjula on Jun 21, 2017
Latest reply on Jun 22, 2017 by kenbuja

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.

arcgis javascript 4.3

Outcomes