Select to view content in your preferred language

Field names returned from Query vs Identify

2339
2
Jump to solution
04-30-2014 02:34 PM
KenBuja
MVP Esteemed Contributor
Why are the attributes of a feature returned from a Query shown with the field names while the attributes of a feature returned from an Identify shown with field aliases? This example lists the field names in the console for each.

[ATTACH=CONFIG]33494[/ATTACH][ATTACH=CONFIG]33495[/ATTACH]

I'm building the data store for dGrids two ways. In one grid, I'm getting all the records from the results of Query to show all the available features. In another grid, I'm building the data store from the results of an Identify where the user clicks on the map. Both grids have a column with an icon that indicates that there are photos at that site. The user can click on the icon to show a slideshow of the photos.

I'm using a rendercell function to create a popup window with the slideshow.

        function renderPhotoColumn(object, value, cell, options) {             if (object.PhotoCount > 0) {                 var image = new Image();                 image.src = "../resources/assets/images/CheckMark.png";                 image.onclick = function () { createSlideShow(object) };                 return image;             }         }          function createSlideShow(siteObject) {             try {                 fpSlideshow.setTitle("Site " + siteObject["Site ID"] + " photos");                  var data = [];                 for (var i = 1; i <= siteObject.PhotoCount; i++) {                      data.push({                         image: parameters.photoURL + "thumbnails/" + siteObject["Site ID"] + "_" + i + ".jpg",                         link: parameters.photoURL + siteObject["Site ID"] + "_" + i + ".jpg"                     });                 }                 Galleria.configure({                     popupLinks: true                 });                 Galleria.run('.galleria', {                     dataSource: data                 });                 fpSlideshow.show();             }              catch (e) { console.log("createSlideshow - " + e.message); }         } 


However, since the field names are not the same ("Site ID" versus "SITE_ID"), this breaks for the grid created from the Query.

[ATTACH=CONFIG]33497[/ATTACH][ATTACH=CONFIG]33496[/ATTACH]
0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable
Original User: kenbuja

There is a bug (NIM060307) current in the system about this.


Add option to return field names instead of field alias in the Identify functionality of the REST API


However, since this was originally submitted in August 2010, I'm not holding my breath on this getting resolved any time soon. In the meantime, I was able to get around the problem by using this workaround.

        function createSlideShow(siteObject) {             try {                 var siteID = siteObject["Site ID"];                 if (siteID == undefined) { siteID = siteObject["SITE_ID"] }                  fpSlideshow.setTitle("Site " + siteID + " photos");                  var data = [];                 for (var i = 1; i <= siteObject.PhotoCount; i++) {                      data.push({                         image: parameters.photoURL + "thumbnails/" + siteID + "_" + i + ".jpg",                         link: parameters.photoURL + siteID + "_" + i + ".jpg"                     });                 }                 Galleria.configure({                     popupLinks: true                 });                 Galleria.run('.galleria', {                     dataSource: data                 });                 fpSlideshow.show();             }              catch (e) { console.log("createSlideshow - " + e.message); }         } 

View solution in original post

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus
Ken,

   The way that the ArcGIS Server team developed the Identify Task, it has always returned aliases for field names (as far back as I can remember). I always had an issue with this in my flex identify widget, have to make sure people used the field alias in their configuration file. I then moved to using an initial layer details task to match the aliases with the actual field names to get past this. I know that is a bit of work just to get that to work but, as I mentioned the Identify Task has always been like this and it is very unlikely that the ArcGIS Server team is going to change it after all these years.
0 Kudos
by Anonymous User
Not applicable
Original User: kenbuja

There is a bug (NIM060307) current in the system about this.


Add option to return field names instead of field alias in the Identify functionality of the REST API


However, since this was originally submitted in August 2010, I'm not holding my breath on this getting resolved any time soon. In the meantime, I was able to get around the problem by using this workaround.

        function createSlideShow(siteObject) {             try {                 var siteID = siteObject["Site ID"];                 if (siteID == undefined) { siteID = siteObject["SITE_ID"] }                  fpSlideshow.setTitle("Site " + siteID + " photos");                  var data = [];                 for (var i = 1; i <= siteObject.PhotoCount; i++) {                      data.push({                         image: parameters.photoURL + "thumbnails/" + siteID + "_" + i + ".jpg",                         link: parameters.photoURL + siteID + "_" + i + ".jpg"                     });                 }                 Galleria.configure({                     popupLinks: true                 });                 Galleria.run('.galleria', {                     dataSource: data                 });                 fpSlideshow.show();             }              catch (e) { console.log("createSlideshow - " + e.message); }         } 
0 Kudos