<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic FeatureLayer.Attributes by field alias? in ArcGIS Viewer for Silverlight Questions</title>
    <link>https://community.esri.com/t5/arcgis-viewer-for-silverlight-questions/featurelayer-attributes-by-field-alias/m-p/726043#M1957</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I was trying to use the plugin example&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://www.arcgis.com/home/item.html?id=044f7170f1f9423b8026719e1d9e4510" rel="nofollow noopener noreferrer" target="_blank"&gt;Query Related Records Tool&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;and find out a bug. At least I think so.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;With feature layer &lt;/SPAN&gt;&lt;A href="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSPetro/MapServer/1" rel="nofollow noopener noreferrer" target="_blank"&gt;http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSPetro/MapServer/1&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;this code wan't work&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
// Get the name of the ObjectID field.
objectID = relatesLayer.LayerInfo.ObjectIdField;
// get key value
Object v = inputFeature.Attributes[objectID]; // v is empty&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but this code work just fine&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
// Get the name of the ObjectID field.
objectID = relatesLayer.LayerInfo.ObjectIdField;
string objectIDAlias = getFieldAlias(relatesLayer, objectID);
if(objectIDAlias != "") objectID = objectIDAlias; // because of bug? in Graphic.Attributes[fieldname];
// get key value
Object v = inputFeature.Attributes[objectID]; // v have id value
&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Because of feature layer has objectid field alias 'Object ID' and Attributes object give access to values by field alias.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I think, Attributes object must give access to values by field names.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 07:03:20 GMT</pubDate>
    <dc:creator>ValentinFedulov</dc:creator>
    <dc:date>2021-12-12T07:03:20Z</dc:date>
    <item>
      <title>FeatureLayer.Attributes by field alias?</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-silverlight-questions/featurelayer-attributes-by-field-alias/m-p/726043#M1957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I was trying to use the plugin example&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://www.arcgis.com/home/item.html?id=044f7170f1f9423b8026719e1d9e4510" rel="nofollow noopener noreferrer" target="_blank"&gt;Query Related Records Tool&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;and find out a bug. At least I think so.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;With feature layer &lt;/SPAN&gt;&lt;A href="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSPetro/MapServer/1" rel="nofollow noopener noreferrer" target="_blank"&gt;http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSPetro/MapServer/1&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;this code wan't work&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
// Get the name of the ObjectID field.
objectID = relatesLayer.LayerInfo.ObjectIdField;
// get key value
Object v = inputFeature.Attributes[objectID]; // v is empty&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but this code work just fine&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
// Get the name of the ObjectID field.
objectID = relatesLayer.LayerInfo.ObjectIdField;
string objectIDAlias = getFieldAlias(relatesLayer, objectID);
if(objectIDAlias != "") objectID = objectIDAlias; // because of bug? in Graphic.Attributes[fieldname];
// get key value
Object v = inputFeature.Attributes[objectID]; // v have id value
&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Because of feature layer has objectid field alias 'Object ID' and Attributes object give access to values by field alias.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I think, Attributes object must give access to values by field names.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:03:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-silverlight-questions/featurelayer-attributes-by-field-alias/m-p/726043#M1957</guid>
      <dc:creator>ValentinFedulov</dc:creator>
      <dc:date>2021-12-12T07:03:20Z</dc:date>
    </item>
  </channel>
</rss>

