I have a map service with one layer and three related tables. I can successfully execute queries against my related tables and return values. The problem I am having is that I only get the field names and not their aliases. How can I access field aliases of the tables?
Andrew,
You use the esri request class to get the json for the layer and that will have the fields and aliases array
require([ "esri/request", ... ], function(esriRequest, ... ) { var layerUrl = "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/0"; var layersRequest = esriRequest({ url: layerUrl, content: { f: "json" }, handleAs: "json", callbackParamName: "callback" }); layersRequest.then( function(response) { console.log("Success: ", response.fields); }, function(error) { console.log("Error: ", error.message); }); ... });<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
.
Am I correct to assume I will have to do this for every related table? Then, store the array and query it by the field name to get the alias?
Yes
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.