<?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 query.where clause using variable for field name instead of hard coded in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-where-clause-using-variable-for-field-name/m-p/700189#M65219</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm sure if it wasn't Friday afternoon, I'd figure this out on my own.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to set up a more generic function to construct and execute a query task.&amp;nbsp;&amp;nbsp; Instead of having my query.where clause be something like &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;selQuery.where = "DISTRICT= '" + myCode + "'";&amp;nbsp; //myCode coming from a FilteringSelect value&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'd like the field name to also be a variable.&amp;nbsp; But I think the syntax for the where clause needs to be in the form of "FIELDNAME" = 'myValue', and I'm not quite sure how to get the quotes properly formatted in the string.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please someone who's brain is still functioning, help me out!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 11 Oct 2013 18:14:55 GMT</pubDate>
    <dc:creator>TracySchloss</dc:creator>
    <dc:date>2013-10-11T18:14:55Z</dc:date>
    <item>
      <title>query.where clause using variable for field name instead of hard coded</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-where-clause-using-variable-for-field-name/m-p/700189#M65219</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm sure if it wasn't Friday afternoon, I'd figure this out on my own.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to set up a more generic function to construct and execute a query task.&amp;nbsp;&amp;nbsp; Instead of having my query.where clause be something like &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;selQuery.where = "DISTRICT= '" + myCode + "'";&amp;nbsp; //myCode coming from a FilteringSelect value&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'd like the field name to also be a variable.&amp;nbsp; But I think the syntax for the where clause needs to be in the form of "FIELDNAME" = 'myValue', and I'm not quite sure how to get the quotes properly formatted in the string.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please someone who's brain is still functioning, help me out!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Oct 2013 18:14:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-where-clause-using-variable-for-field-name/m-p/700189#M65219</guid>
      <dc:creator>TracySchloss</dc:creator>
      <dc:date>2013-10-11T18:14:55Z</dc:date>
    </item>
    <item>
      <title>Re: query.where clause using variable for field name instead of hard coded</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-where-clause-using-variable-for-field-name/m-p/700190#M65220</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Tracy,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Just make sure your field variable is a string.&amp;nbsp; There &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://developers.arcgis.com/en/javascript/jsapi/query.html#where" rel="nofollow" target="_blank"&gt;where property is type string.&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;var myField = "DISTRICT"; . . . selQuery.where = myField + " = '" + myCode + "'"&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I actually build the entire where statement in a string variable in most of my applications, then set .where to the variable.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps and Happy Friday,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chris B.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Oct 2013 18:30:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-where-clause-using-variable-for-field-name/m-p/700190#M65220</guid>
      <dc:creator>ChristopherBlinn1</dc:creator>
      <dc:date>2013-10-11T18:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: query.where clause using variable for field name instead of hard coded</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-where-clause-using-variable-for-field-name/m-p/700191#M65221</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I tried that first, before I sent this and it wasn't working.&amp;nbsp; I've changed several places in this function to use variables instead, maybe I should be expand to other lines.&amp;nbsp; This might not be the problem at all! &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Like I said - Friday - brain dead.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Oct 2013 19:03:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-where-clause-using-variable-for-field-name/m-p/700191#M65221</guid>
      <dc:creator>TracySchloss</dc:creator>
      <dc:date>2013-10-11T19:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: query.where clause using variable for field name instead of hard coded</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-where-clause-using-variable-for-field-name/m-p/700192#M65222</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you would like to post your entire function, I'd gladly take a look at it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Or if your application is publicly accessible I can look from there.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Oct 2013 19:21:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-where-clause-using-variable-for-field-name/m-p/700192#M65222</guid>
      <dc:creator>ChristopherBlinn1</dc:creator>
      <dc:date>2013-10-11T19:21:40Z</dc:date>
    </item>
    <item>
      <title>Re: query.where clause using variable for field name instead of hard coded</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-where-clause-using-variable-for-field-name/m-p/700193#M65223</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the offer.&amp;nbsp; I have a feeling it's something right in front of me, so I'm going to try&amp;nbsp; a little longer.&amp;nbsp; No sense in embarrassing myself.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Oct 2013 20:04:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-where-clause-using-variable-for-field-name/m-p/700193#M65223</guid>
      <dc:creator>TracySchloss</dc:creator>
      <dc:date>2013-10-11T20:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: query.where clause using variable for field name instead of hard coded</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-where-clause-using-variable-for-field-name/m-p/700194#M65224</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sure enough, I had renamed my errorHandler function, but forgot to change the queryTask.on event listener &lt;/SPAN&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt; queryTask.on('error', populateErrorHandler); &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Oct 2013 20:10:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-where-clause-using-variable-for-field-name/m-p/700194#M65224</guid>
      <dc:creator>TracySchloss</dc:creator>
      <dc:date>2013-10-11T20:10:26Z</dc:date>
    </item>
    <item>
      <title>Re: query.where clause using variable for field name instead of hard coded</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-where-clause-using-variable-for-field-name/m-p/700195#M65225</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Glad you found it!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Oct 2013 20:13:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-where-clause-using-variable-for-field-name/m-p/700195#M65225</guid>
      <dc:creator>ChristopherBlinn1</dc:creator>
      <dc:date>2013-10-11T20:13:57Z</dc:date>
    </item>
  </channel>
</rss>

