<?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 Creating a query statement in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/creating-a-query-statement/m-p/207082#M7076</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would like to display a the result of a query that loops thru an array. The query statement should look the&lt;/P&gt;&lt;P&gt;one shown below:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;countryCodes = [840, 332, 643, 724, ....];&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for (var i = 0; i &amp;lt; countryCodes.length; i++)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; cntryq.where =&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "UN = " + countryCodes = &lt;I&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;cntryq.where =&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "UN = " + countryCodes = [0] + "OR UN = " + countryCodes = [1] + ....&lt;/P&gt;&lt;P&gt;Is this possible?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My script is attached&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 17 Oct 2014 15:07:16 GMT</pubDate>
    <dc:creator>joepublic</dc:creator>
    <dc:date>2014-10-17T15:07:16Z</dc:date>
    <item>
      <title>Creating a query statement</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/creating-a-query-statement/m-p/207082#M7076</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would like to display a the result of a query that loops thru an array. The query statement should look the&lt;/P&gt;&lt;P&gt;one shown below:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;countryCodes = [840, 332, 643, 724, ....];&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for (var i = 0; i &amp;lt; countryCodes.length; i++)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; cntryq.where =&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "UN = " + countryCodes = &lt;I&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;cntryq.where =&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "UN = " + countryCodes = [0] + "OR UN = " + countryCodes = [1] + ....&lt;/P&gt;&lt;P&gt;Is this possible?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My script is attached&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Oct 2014 15:07:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/creating-a-query-statement/m-p/207082#M7076</guid>
      <dc:creator>joepublic</dc:creator>
      <dc:date>2014-10-17T15:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a query statement</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/creating-a-query-statement/m-p/207083#M7077</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You access objects in an array like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14135595262891823 jive_text_macro" jivemacro_uid="_14135595262891823"&gt;
&lt;P&gt;countryCodes&lt;I&gt;&lt;/I&gt;&lt;/P&gt;



&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What you should do is build a query like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"UN in (840, 332, 643, 724, ....)"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which is the same as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"UN = 840 OR UN = 332 OR ..."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So you can build the statement this way&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14135597210092128 jive_text_macro" jivemacro_uid="_14135597210092128" modifiedtitle="true"&gt;
&lt;P&gt;var inString = "";&lt;/P&gt;
&lt;P&gt;for (var i = 0; i &amp;lt; countryCodes.length; i++)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; inString += countryCodes&lt;I&gt; + ", ";&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;inString.slice(0, -2);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;cntryq.where = "UN in (" + inString + ")";&lt;/P&gt;



&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Oct 2014 15:33:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/creating-a-query-statement/m-p/207083#M7077</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2014-10-17T15:33:30Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a query statement</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/creating-a-query-statement/m-p/207084#M7078</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks you Ken!!&lt;/P&gt;&lt;P&gt;Problem solved&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Oct 2014 19:54:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/creating-a-query-statement/m-p/207084#M7078</guid>
      <dc:creator>joepublic</dc:creator>
      <dc:date>2014-10-17T19:54:01Z</dc:date>
    </item>
  </channel>
</rss>

