<?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: Dynamically fill drop down list in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-fill-drop-down-list/m-p/595300#M55765</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;April,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;In that case then when the user select an option from the first select element it has an event listener that calls the&amp;nbsp;setWellsDefinitionExpression function. You need to take that SQL statement (i.e. "STATUS2 = '" + newValue + "'") and query the featurelayer.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; Select2 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; document&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;getElementById&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"the id of your second select"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; query2 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; wellsLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;createQuery&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;//get the layer exisiting definitionExpression (the first dropdowns value)&lt;/SPAN&gt;
query2&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;where &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; wellsLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;definitionExpression&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
wellsLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;queryFeatures&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;query2&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;then&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;getValues2&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;then&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;getUniqueValues&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;then&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;addToSelect2&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;addToSelect2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;values&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  values&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;sort&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  values&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;forEach&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;value&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; option &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; document&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;createElement&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"option"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    option&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;text &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; value&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    Select2&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;add&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;option&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

  &lt;SPAN class="comment token"&gt;//return setWellsDefinitionExpression(Select2.value);&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

&lt;SPAN class="comment token"&gt;// return an array of all the values in the&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// your field&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;getValues2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;response&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; features &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; response&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;features&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; values &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; features&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;map&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;feature&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
   &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; feature&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;attributes&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;YOURSECONDFIELD&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; values&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 01:33:42 GMT</pubDate>
    <dc:creator>RobertScheitlin__GISP</dc:creator>
    <dc:date>2021-12-12T01:33:42Z</dc:date>
    <item>
      <title>Dynamically fill drop down list</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-fill-drop-down-list/m-p/595299#M55764</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using this as an example to achieve what I want&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=featurelayer-query" title="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=featurelayer-query"&gt;ArcGIS API for JavaScript Sandbox&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code dynamically retrieves the list in the dropdown from the feature layer. How do I modify i so that I can dynamically retrieve values for the next dropdown based on the previous one. Basically, I want to retrieve values of another field using select by attribute and populate the next dropdown with the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried whatever I could but I could not get it to work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Requesting for some pointers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Mar 2020 21:46:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-fill-drop-down-list/m-p/595299#M55764</guid>
      <dc:creator>AprilSummers</dc:creator>
      <dc:date>2020-03-16T21:46:40Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically fill drop down list</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-fill-drop-down-list/m-p/595300#M55765</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;April,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;In that case then when the user select an option from the first select element it has an event listener that calls the&amp;nbsp;setWellsDefinitionExpression function. You need to take that SQL statement (i.e. "STATUS2 = '" + newValue + "'") and query the featurelayer.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; Select2 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; document&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;getElementById&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"the id of your second select"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; query2 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; wellsLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;createQuery&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;//get the layer exisiting definitionExpression (the first dropdowns value)&lt;/SPAN&gt;
query2&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;where &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; wellsLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;definitionExpression&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
wellsLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;queryFeatures&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;query2&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;then&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;getValues2&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;then&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;getUniqueValues&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;then&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;addToSelect2&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;addToSelect2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;values&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  values&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;sort&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  values&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;forEach&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;value&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; option &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; document&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;createElement&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"option"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    option&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;text &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; value&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    Select2&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;add&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;option&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

  &lt;SPAN class="comment token"&gt;//return setWellsDefinitionExpression(Select2.value);&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

&lt;SPAN class="comment token"&gt;// return an array of all the values in the&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// your field&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;getValues2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;response&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; features &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; response&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;features&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; values &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; features&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;map&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;feature&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
   &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; feature&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;attributes&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;YOURSECONDFIELD&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; values&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:33:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-fill-drop-down-list/m-p/595300#M55765</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-12T01:33:42Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically fill drop down list</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-fill-drop-down-list/m-p/595301#M55766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/3101"&gt;Robert Scheitlin, GISP&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much! I adapted your script to get my code working the way I wanted. I am able to get the other drop-down to dynamically populate values. I need to tweak it a bit more because when I change the first dropdown, the second dropdown just appends the values to the second dropdown from the previous selection.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Having made this work (though not ideal way),&amp;nbsp; when I run the QueryForWellsGeometries function (I want this as my final geometry return function and not the CreateBuffer()), I get an error that I am unable to understand how to decode. Any pointers?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I haven't changed anything in that function because when I run the create query, I assume that in considers the query using the SetDefinitionExpressionQuery where the definition expression is taking into consideration values of both dropdowns&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Mar 2020 17:12:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-fill-drop-down-list/m-p/595301#M55766</guid>
      <dc:creator>AprilSummers</dc:creator>
      <dc:date>2020-03-21T17:12:39Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically fill drop down list</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-fill-drop-down-list/m-p/595302#M55767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;IMG alt="" class="jive-emoji image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/485903_Untitled.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;BR /&gt;&amp;lt;html&amp;gt;&lt;BR /&gt; &amp;lt;head&amp;gt;&lt;BR /&gt; &amp;lt;meta charset="utf-8" /&amp;gt;&lt;BR /&gt; &amp;lt;meta&lt;BR /&gt; name="viewport"&lt;BR /&gt; content="initial-scale=1,maximum-scale=1,user-scalable=no"&lt;BR /&gt; /&amp;gt;&lt;BR /&gt; &amp;lt;title&amp;gt;Query features from a FeatureLayer - 4.14&amp;lt;/title&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;link&lt;BR /&gt; rel="stylesheet"&lt;BR /&gt; href="https://js.arcgis.com/4.14/esri/themes/light/main.css"&lt;BR /&gt; /&amp;gt;&lt;BR /&gt; &amp;lt;script src="https://js.arcgis.com/4.14/"&amp;gt;&amp;lt;/script&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;style&amp;gt;&lt;BR /&gt; html,&lt;BR /&gt; body,&lt;BR /&gt; #viewDiv {&lt;BR /&gt; height: 100%;&lt;BR /&gt; width: 100%;&lt;BR /&gt; margin: 0;&lt;BR /&gt; padding: 0;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;#infoDiv {&lt;BR /&gt; background-color: white;&lt;BR /&gt; color: black;&lt;BR /&gt; padding: 6px;&lt;BR /&gt; width: 400px;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;#results {&lt;BR /&gt; font-weight: bolder;&lt;BR /&gt; padding-top: 10px;&lt;BR /&gt; }&lt;BR /&gt; .slider {&lt;BR /&gt; width: 100%;&lt;BR /&gt; height: 60px;&lt;BR /&gt; }&lt;BR /&gt; #drop-downs {&lt;BR /&gt; padding-bottom: 15px;&lt;BR /&gt; }&lt;BR /&gt; &amp;lt;/style&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;script&amp;gt;&lt;BR /&gt; require([&lt;BR /&gt; "esri/Map",&lt;BR /&gt; "esri/views/MapView",&lt;BR /&gt; "esri/layers/FeatureLayer",&lt;BR /&gt; "esri/layers/GraphicsLayer",&lt;BR /&gt; "esri/geometry/geometryEngine",&lt;BR /&gt; "esri/Graphic",&lt;BR /&gt; "esri/widgets/Slider"&lt;BR /&gt; ], function(&lt;BR /&gt; Map,&lt;BR /&gt; MapView,&lt;BR /&gt; FeatureLayer,&lt;BR /&gt; GraphicsLayer,&lt;BR /&gt; geometryEngine,&lt;BR /&gt; Graphic,&lt;BR /&gt; Slider&lt;BR /&gt; ) {&lt;BR /&gt; var wellBuffer, wellsGeometries, magnitude;&lt;/P&gt;&lt;P&gt;var wellTypeSelect = document.getElementById("well-type");&lt;BR /&gt; var wellTypeTwoSelect = document.getElementById("well-typetwo");&lt;/P&gt;&lt;P&gt;var queryWellsButton = document.getElementById("query-wells");&lt;/P&gt;&lt;P&gt;// oil and gas wells&lt;BR /&gt; var wellsLayer = new FeatureLayer({&lt;BR /&gt; portalItem: {&lt;BR /&gt; // autocasts as new PortalItem()&lt;BR /&gt; id: "8af8dc98e75049bda6811b0cdf9450ee"&lt;BR /&gt; },&lt;BR /&gt; outFields: ["*"],&lt;BR /&gt; visible: false&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;// GraphicsLayer for displaying results&lt;BR /&gt; var resultsLayer = new GraphicsLayer();&lt;/P&gt;&lt;P&gt;var map = new Map({&lt;BR /&gt; basemap: "dark-gray",&lt;BR /&gt; layers: [wellsLayer, resultsLayer]&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;var view = new MapView({&lt;BR /&gt; container: "viewDiv",&lt;BR /&gt; map: map,&lt;BR /&gt; center: [-97.75188, 37.23308],&lt;BR /&gt; zoom: 10&lt;BR /&gt; });&lt;BR /&gt; view.ui.add("infoDiv", "top-right");&lt;/P&gt;&lt;P&gt;// query all features from the wells layer&lt;BR /&gt; view&lt;BR /&gt; .when(function() {&lt;BR /&gt; return wellsLayer.when(function() {&lt;BR /&gt; console.log("map loads");&lt;BR /&gt; var query = wellsLayer.createQuery();&lt;BR /&gt; return wellsLayer.queryFeatures(query);&lt;BR /&gt; });&lt;BR /&gt; })&lt;BR /&gt; .then(getValues)&lt;BR /&gt; .then(getUniqueValues)&lt;BR /&gt; .then(addToSelect);&lt;/P&gt;&lt;P&gt;function getValues(response) {&lt;BR /&gt; var features = response.features;&lt;BR /&gt; var values = features.map(function(feature) {&lt;BR /&gt; return feature.attributes.STATUS2;&lt;BR /&gt; });&lt;BR /&gt; console.log("Get Well status values");&lt;BR /&gt; return values;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;function getUniqueValues(values) {&lt;BR /&gt; console.log(start function);&lt;BR /&gt; var uniqueValues = [];&lt;/P&gt;&lt;P&gt;values.forEach(function(item, i) {&lt;BR /&gt; if ((uniqueValues.length &amp;lt; 1 || uniqueValues.indexOf(item) === -1) &amp;amp;&amp;amp; item !== "") {&lt;BR /&gt; uniqueValues.push(item);&lt;BR /&gt; }&lt;BR /&gt; });&lt;BR /&gt; console.log("Get Well status unique values ");&lt;BR /&gt; return uniqueValues;&lt;BR /&gt; }&lt;BR /&gt; &lt;BR /&gt; function addToSelect(values) {&lt;BR /&gt; values.sort();&lt;BR /&gt; values.forEach(function(value) {&lt;BR /&gt; var option = document.createElement("option");&lt;BR /&gt; option.text = value;&lt;BR /&gt; wellTypeSelect.add(option);&lt;BR /&gt; });&lt;BR /&gt; console.log("Add well status values to dropdown");&lt;BR /&gt; //return setWellsDefinitionExpression(wellTypeSelect.value);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;function setWellsStatusExpression(newValue) {&lt;BR /&gt; wellsLayer.definitionExpression = "STATUS2 = '" + newValue + "'";&lt;/P&gt;&lt;P&gt;if (!wellsLayer.visible) {&lt;BR /&gt; wellsLayer.visible = true;&lt;BR /&gt; }&lt;BR /&gt; console.log(&lt;BR /&gt; "Sets definition expression only well status is available"&lt;BR /&gt; );&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;function setWellsDefinitionExpression(newValue1, newValue2) {&lt;BR /&gt; if ((newValue2 = undefined)) {&lt;BR /&gt; console.log("Only STATUS2 is available");&lt;BR /&gt; wellsLayer.definitionExpression = "STATUS2 = '" + newValue1 + "'";&lt;BR /&gt; } else {&lt;BR /&gt; console.log("Both status are available");&lt;BR /&gt; wellsLayer.definitionExpression =&lt;BR /&gt; "STATUS2 = '" + newValue1 + "AND STATUS = '" + newValue2 + "'";&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (!wellsLayer.visible) {&lt;BR /&gt; wellsLayer.visible = true;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;return queryForWellGeometries();&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;function queryForWellGeometries() {&lt;BR /&gt; console.log("Query well geometries");&lt;BR /&gt; var wellsQuery = wellsLayer.createQuery();&lt;/P&gt;&lt;P&gt;return wellsLayer.queryFeatures(wellsQuery).then(function(response) {&lt;BR /&gt; wellsGeometries = response.features.map(function(feature) {&lt;BR /&gt; return feature.geometry;&lt;BR /&gt; });&lt;BR /&gt; return wellsGeometries;&lt;BR /&gt; });&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;wellTypeSelect.addEventListener("change", function() {&lt;BR /&gt; console.log("Change Well status values in dropdown");&lt;BR /&gt; var type = event.target.value;&lt;BR /&gt; setWellsStatusExpression(type);&lt;BR /&gt; filterWellType();&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;function filterWellType() {&lt;BR /&gt; console.log("Filter for well type");&lt;BR /&gt; var query2 = wellsLayer.createQuery();&lt;BR /&gt; query2.where = wellsLayer.definitionExpression;&lt;/P&gt;&lt;P&gt;wellsLayer&lt;BR /&gt; .queryFeatures(query2)&lt;BR /&gt; .then(getQuery2Values)&lt;BR /&gt; .then(getUniqueValues)&lt;BR /&gt; .then(addToSelectQuery2);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;function getQuery2Values(response) {&lt;BR /&gt; var featuresQuery2 = response.features;&lt;BR /&gt; var query2Values = featuresQuery2.map(function(feature) {&lt;BR /&gt; return feature.attributes.STATUS;&lt;BR /&gt; });&lt;BR /&gt; console.log("Get Well type values");&lt;BR /&gt; return query2Values;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;//Add the unique values to the STS Route type select element. This will allow the user to filter by campaigns.&lt;BR /&gt; function addToSelectQuery2(query2Values) {&lt;BR /&gt; query2Values.sort();&lt;BR /&gt; query2Values.forEach(function(value) {&lt;BR /&gt; var option = document.createElement("option");&lt;BR /&gt; option.text = value;&lt;BR /&gt; query2Values.add(option);&lt;BR /&gt; });&lt;BR /&gt; console.log("Add well type values to second dropdown");&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;//Set a new definitionExpression on the STS Route layer and view the selected campaign and run&lt;BR /&gt; wellTypeTwoSelect.addEventListener("change", function() {&lt;BR /&gt; console.log("Get Well status values");&lt;BR /&gt; var type = event.target.value;&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;queryWellsButton.addEventListener("click", function() {&lt;BR /&gt; var type = event.target.value;&lt;BR /&gt; setWellsDefinitionExpression(values.value, query2Values.value).then(&lt;BR /&gt; queryForWellGeometries&lt;BR /&gt; );&lt;BR /&gt; });&lt;BR /&gt; });&lt;BR /&gt; &amp;lt;/script&amp;gt;&lt;BR /&gt; &amp;lt;/head&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;body&amp;gt;&lt;BR /&gt; &amp;lt;div id="viewDiv"&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt; &amp;lt;div id="infoDiv" class="esri-widget"&amp;gt;&lt;BR /&gt; &amp;lt;div id="drop-downs"&amp;gt;&lt;BR /&gt; Select well status:&lt;BR /&gt; &amp;lt;select id="well-type" class="esri-widget"&lt;BR /&gt; &amp;gt;&amp;lt;option value=""&amp;gt;Select well status&amp;lt;/option&amp;gt;&amp;lt;/select&lt;BR /&gt; &amp;gt;&lt;BR /&gt; Select well type:&lt;BR /&gt; &amp;lt;select id="well-typetwo" class="esri-widget"&lt;BR /&gt; &amp;gt;&amp;lt;option value=""&amp;gt;Select well type&amp;lt;/option&amp;gt;&amp;lt;/select&lt;BR /&gt; &amp;gt;&lt;BR /&gt; &amp;lt;/div&amp;gt;&lt;BR /&gt; &amp;lt;button id="query-wells" class="esri-widget"&amp;gt;Query Wells&amp;lt;/button&amp;gt;&lt;BR /&gt; &amp;lt;div id="results" class="esri-widget"&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt; &amp;lt;/div&amp;gt;&lt;BR /&gt; &amp;lt;/body&amp;gt;&lt;BR /&gt;&amp;lt;/html&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Mar 2020 17:18:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-fill-drop-down-list/m-p/595302#M55767</guid>
      <dc:creator>AprilSummers</dc:creator>
      <dc:date>2020-03-21T17:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically fill drop down list</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-fill-drop-down-list/m-p/595303#M55768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry for all the spam! It finally works exactly like I want!! &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/grin.png" /&gt;&amp;nbsp;I had a missing quote to end my string in the query function.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you &lt;A href="https://community.esri.com/migrated-users/3101"&gt;Robert Scheitlin, GISP&lt;/A&gt;‌!&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Mar 2020 18:47:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-fill-drop-down-list/m-p/595303#M55768</guid>
      <dc:creator>AprilSummers</dc:creator>
      <dc:date>2020-03-21T18:47:35Z</dc:date>
    </item>
  </channel>
</rss>

