I've been trying to read through the ArcGIS JavaScript API but can't find what I want.I have a web map on my page that is based on my my map stored on ArcGIS online.I want to create an if/else statement that does different things based on the value of a field in the layer. But I'm having a hard time accessing the field of the layer I want. Here is part of the JavaScript in my HTML code. var exLayer = actualmap.getLayer(actualmap.layerIds[6]).layerInfos[0];
console.log(exLayer);
With the code above, I am able to access the layer I want in my web map. The web service I want is number 6 on the AGOL map, and the layer I want on this web service is number 0. I'm trying to access the field in layer 0 called "TID", and I want to get the rows with "TID" > 0 and rows "TID" = 0 for my if/else statement. I tried the below to access field names, but it didn't work. It just gave me the layer name. var test1 = Field(exLayer).name;
console.log(test1);
Any suggestions?