<?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 Re: How do I get a JSON name and value from and array? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-get-a-json-name-and-value-from-an-array/m-p/660915#M61707</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is basically returning feature Array.&lt;/P&gt;&lt;P&gt;Line that says:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;resultItems.push("&amp;lt;b&amp;gt;" + attr + ":&amp;lt;/b&amp;gt;&amp;nbsp; " + featureAttributes[attr] + "&amp;lt;br&amp;gt;");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;change it to&lt;/P&gt;&lt;P&gt;featureAttributes[&lt;STRONG&gt;'OBJECTID'&lt;/STRONG&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this would return all the OBJECTIDs. for accesing &lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: medium;"&gt;&lt;STRONG&gt;VISIBILITY &lt;/STRONG&gt;&lt;/SPAN&gt;of all items use this&lt;/P&gt;&lt;P&gt;featureAttributes[&lt;STRONG&gt;'VISIBILITY'&lt;/STRONG&gt;];&lt;/P&gt;&lt;P&gt;This is how you access it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to update control with specific OBJECTID:&lt;/P&gt;&lt;P&gt;Change line that says:&lt;/P&gt;&lt;P&gt;resultItems.push("&amp;lt;b&amp;gt;" + attr + ":&amp;lt;/b&amp;gt;&amp;nbsp; " + featureAttributes[attr] + "&amp;lt;br&amp;gt;");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;For example we want to change SITEOBS from clear to Unclear of OBJECTID &lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: medium; background-color: #eeeeee;"&gt;9265&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #eeeeee; color: #000000; font-size: medium; font-family: 'Times New Roman';"&gt;&lt;STRONG&gt;if(featureAttributes['OBJECTID'] == 9265) {&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #eeeeee; color: #000000; font-size: medium; font-family: 'Times New Roman';"&gt;&lt;STRONG&gt;featureAttributes['SITEOBS'] = 'UnClear';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #eeeeee; color: #000000; font-size: medium; font-family: 'Times New Roman';"&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To update a control like text box:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #eeeeee; color: #000000; font-size: medium; font-family: 'Times New Roman';"&gt;&lt;STRONG&gt;if(featureAttributes['OBJECTID'] == 9265) {&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #eeeeee; color: #000000; font-size: medium; font-family: 'Times New Roman';"&gt;&lt;STRONG&gt;document.getElementById('siteobsTxt').innerText = featureAttributes['SITEOBS'] ;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #eeeeee; color: #000000; font-size: medium; font-family: 'Times New Roman';"&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helped.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 17 Jun 2015 12:59:38 GMT</pubDate>
    <dc:creator>omega_cancer</dc:creator>
    <dc:date>2015-06-17T12:59:38Z</dc:date>
    <item>
      <title>How do I get a JSON name and value from an array?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-get-a-json-name-and-value-from-an-array/m-p/660914#M61706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/3101"&gt;Robert Scheitlin, GISP&lt;/A&gt; helped me by providing this example to return an array based on value: &lt;A href="http://jsbin.com/daboyopesa/edit?html,output" title="http://jsbin.com/daboyopesa/edit?html,output"&gt;JS Bin - Collaborative JavaScript Debugging&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But how do I get each name and value in my array?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this example a supportId of 691 is selected. I have a form that I want to update only one set of values at at time, so how do get just the name;&lt;/P&gt;&lt;P&gt;SIGNID&amp;nbsp; and the value of 1169 so that I may set SIGNID's value to 1169 on the form. I basically want to update my form with all the values in the first element of the array, but I am not sure how to select JSON items. The following items are in my array and I will want to replace each as the user click previous or next.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="110649" alt="StreetSignsForm.png" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/110649_StreetSignsForm.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2015 21:39:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-get-a-json-name-and-value-from-an-array/m-p/660914#M61706</guid>
      <dc:creator>ChrisSergent</dc:creator>
      <dc:date>2015-06-16T21:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get a JSON name and value from and array?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-get-a-json-name-and-value-from-an-array/m-p/660915#M61707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is basically returning feature Array.&lt;/P&gt;&lt;P&gt;Line that says:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;resultItems.push("&amp;lt;b&amp;gt;" + attr + ":&amp;lt;/b&amp;gt;&amp;nbsp; " + featureAttributes[attr] + "&amp;lt;br&amp;gt;");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;change it to&lt;/P&gt;&lt;P&gt;featureAttributes[&lt;STRONG&gt;'OBJECTID'&lt;/STRONG&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this would return all the OBJECTIDs. for accesing &lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: medium;"&gt;&lt;STRONG&gt;VISIBILITY &lt;/STRONG&gt;&lt;/SPAN&gt;of all items use this&lt;/P&gt;&lt;P&gt;featureAttributes[&lt;STRONG&gt;'VISIBILITY'&lt;/STRONG&gt;];&lt;/P&gt;&lt;P&gt;This is how you access it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to update control with specific OBJECTID:&lt;/P&gt;&lt;P&gt;Change line that says:&lt;/P&gt;&lt;P&gt;resultItems.push("&amp;lt;b&amp;gt;" + attr + ":&amp;lt;/b&amp;gt;&amp;nbsp; " + featureAttributes[attr] + "&amp;lt;br&amp;gt;");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;For example we want to change SITEOBS from clear to Unclear of OBJECTID &lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: medium; background-color: #eeeeee;"&gt;9265&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #eeeeee; color: #000000; font-size: medium; font-family: 'Times New Roman';"&gt;&lt;STRONG&gt;if(featureAttributes['OBJECTID'] == 9265) {&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #eeeeee; color: #000000; font-size: medium; font-family: 'Times New Roman';"&gt;&lt;STRONG&gt;featureAttributes['SITEOBS'] = 'UnClear';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #eeeeee; color: #000000; font-size: medium; font-family: 'Times New Roman';"&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To update a control like text box:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #eeeeee; color: #000000; font-size: medium; font-family: 'Times New Roman';"&gt;&lt;STRONG&gt;if(featureAttributes['OBJECTID'] == 9265) {&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #eeeeee; color: #000000; font-size: medium; font-family: 'Times New Roman';"&gt;&lt;STRONG&gt;document.getElementById('siteobsTxt').innerText = featureAttributes['SITEOBS'] ;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #eeeeee; color: #000000; font-size: medium; font-family: 'Times New Roman';"&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helped.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2015 12:59:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-get-a-json-name-and-value-from-an-array/m-p/660915#M61707</guid>
      <dc:creator>omega_cancer</dc:creator>
      <dc:date>2015-06-17T12:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get a JSON name and value from and array?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-get-a-json-name-and-value-from-an-array/m-p/660916#M61708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This helps if I want to manually enter information in. I figured out what I needed to do. I needed to return the attr which is the attribute or name and the feature attribute which is the value of the attribute. I used the following code to do this:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;console.log("Attribute: " + attr);
console.log("Feature Attribue: " + featureAttributes[attr]);&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:58:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-get-a-json-name-and-value-from-an-array/m-p/660916#M61708</guid>
      <dc:creator>ChrisSergent</dc:creator>
      <dc:date>2021-12-12T03:58:19Z</dc:date>
    </item>
  </channel>
</rss>

