Select to view content in your preferred language

unable to read attributes

619
1
09-20-2011 03:53 AM
SantoshV
Emerging Contributor
Hi,
  I have developed a identify tool where I am reading my LayerKeyField from the IdentifyResults

           int intFeatureCount = 0;
            
            //store LayerName and ID 
            foreach (IdentifyResult result in results)
            {
                if (!dicIdentifyResults.Keys.Contains(Convert.ToInt32(results[intFeatureCount].Feature.Attributes["ROADID"])))
                {
                    //store identify results with the layername
                    dicIdentifyResults.Add(Convert.ToInt32(results[intFeatureCount].Feature.Attributes["ROADID"]), results[intFeatureCount].LayerName);
                    intFeatureCount++;
                }
            }


the above code works fine... but

When I query the using QueryTask and read my attribute from that result I dont get the value
            FeatureSet pFeatureSet = e.FeatureSet;
            if (pFeatureSet == null) return;
            if (pFeatureSet.Count() < 1) return;

                int intID = Convert.ToInt32(pFeatureSet.Features[0].Attributes["ROADID"])
//but
int intID = Convert.ToInt32(pFeatureSet.Features[0].Attributes["roadid"])

;


but when I use lower case keyfieldname it works fine .. how is it that it works fine for IdentifyTask but QueryTask

I have also changed the alias name of field to Uppper case in using ArcMap
am i missing something here
0 Kudos
1 Reply
DominiqueBroux
Esri Frequent Contributor
For historical reasons, the identify task is returning the field aliases. That can explain the behavior you got.

If you recently changed the field  aliases in your map service, be sure to clean up your browser cache in order to get the new version of your service metadata.
0 Kudos