<?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: query expression in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-expression/m-p/80293#M7367</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is this true?:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;params.where =&lt;BR /&gt;(attributeName.value + expressionSign.value + value.value)+" AND "+(attributeName2.value + expressionSign2.value + value2.value) ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 18 Aug 2019 19:41:03 GMT</pubDate>
    <dc:creator>anjelinaponkerat</dc:creator>
    <dc:date>2019-08-18T19:41:03Z</dc:date>
    <item>
      <title>query expression</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-expression/m-p/80291#M7365</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I set a query expression by AND operation, but my query can not do any action an get result !&lt;/P&gt;&lt;P&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;QueryTask - 4.12&amp;lt;/title&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; padding: 0;&lt;BR /&gt; margin: 0;&lt;BR /&gt; height: 100%;&lt;BR /&gt; width: 100%;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;#optionsDiv {&lt;BR /&gt; background-color: dimgray;&lt;BR /&gt; color: white;&lt;BR /&gt; padding: 10px;&lt;BR /&gt; width: 350px;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;.esri-popup .esri-popup-header .esri-title {&lt;BR /&gt; font-size: 18px;&lt;BR /&gt; font-weight: bolder;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;.esri-popup .esri-popup-body .esri-popup-content {&lt;BR /&gt; font-size: 14px;&lt;BR /&gt; }&lt;BR /&gt; &amp;lt;/style&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.12/esri/themes/light/main.css"&lt;BR /&gt; /&amp;gt;&lt;BR /&gt; &amp;lt;script src="https://js.arcgis.com/4.12/"&amp;gt;&amp;lt;/script&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/SceneView",&lt;BR /&gt; "esri/layers/GraphicsLayer",&lt;BR /&gt; "esri/tasks/QueryTask",&lt;BR /&gt; "esri/tasks/support/Query"&lt;BR /&gt; ], function(Map, SceneView, GraphicsLayer, QueryTask, Query) {&lt;BR /&gt; // URL to feature service containing points representing the 50&lt;BR /&gt; // most prominent peaks in the U.S.&lt;BR /&gt; var peaksUrl =&lt;BR /&gt; "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Prominent_Peaks_US/FeatureServer/0";&lt;/P&gt;&lt;P&gt;// Define the popup content for each result&lt;BR /&gt; var popupTemplate = {&lt;BR /&gt; // autocasts as new PopupTemplate()&lt;BR /&gt; title: "{MTN_PEAK}, {STATE}",&lt;BR /&gt; fieldInfos: [&lt;BR /&gt; {&lt;BR /&gt; fieldName: "ELEV_ft",&lt;BR /&gt; label: "Elevation (feet)",&lt;BR /&gt; format: {&lt;BR /&gt; places: 0,&lt;BR /&gt; digitSeperator: true&lt;BR /&gt; }&lt;BR /&gt; },&lt;BR /&gt; {&lt;BR /&gt; fieldName: "ELEV_m",&lt;BR /&gt; label: "Elevation (meters)",&lt;BR /&gt; format: {&lt;BR /&gt; places: 0,&lt;BR /&gt; digitSeperator: true&lt;BR /&gt; }&lt;BR /&gt; },&lt;BR /&gt; {&lt;BR /&gt; fieldName: "PROMINENCE_ft",&lt;BR /&gt; label: "Prominence (feet)",&lt;BR /&gt; format: {&lt;BR /&gt; places: 0,&lt;BR /&gt; digitSeperator: true&lt;BR /&gt; }&lt;BR /&gt; },&lt;BR /&gt; {&lt;BR /&gt; fieldName: "PROMINENCE_m",&lt;BR /&gt; label: "Prominence (meters)",&lt;BR /&gt; format: {&lt;BR /&gt; places: 0,&lt;BR /&gt; digitSeperator: true&lt;BR /&gt; }&lt;BR /&gt; },&lt;BR /&gt; {&lt;BR /&gt; fieldName: "ISOLATION_mi",&lt;BR /&gt; label: "Isolation (miles)",&lt;BR /&gt; format: {&lt;BR /&gt; places: 0,&lt;BR /&gt; digitSeperator: true&lt;BR /&gt; }&lt;BR /&gt; },&lt;BR /&gt; {&lt;BR /&gt; fieldName: "ISOLATION_km",&lt;BR /&gt; label: "Isolation (km)",&lt;BR /&gt; format: {&lt;BR /&gt; places: 0,&lt;BR /&gt; digitSeperator: true&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; ],&lt;BR /&gt; content:&lt;BR /&gt; "&amp;lt;b&amp;gt;&amp;lt;a href='https://en.wikipedia.org/wiki/Topographic_prominence'&amp;gt;Prominence:&amp;lt;/a&amp;gt;" +&lt;BR /&gt; "&amp;lt;/b&amp;gt; {PROMINENCE_ft} ft ({PROMINENCE_m} m)" +&lt;BR /&gt; "&amp;lt;br&amp;gt;&amp;lt;b&amp;gt;Prominence Rank:&amp;lt;/b&amp;gt; {RANK}" +&lt;BR /&gt; "&amp;lt;br&amp;gt;&amp;lt;b&amp;gt;Elevation:&amp;lt;/b&amp;gt; {ELEV_ft} ft ({ELEV_m} m)" +&lt;BR /&gt; "&amp;lt;br&amp;gt;&amp;lt;b&amp;gt;&amp;lt;a href='https://en.wikipedia.org/wiki/Topographic_isolation'&amp;gt;Isolation:&amp;lt;/a&amp;gt;" +&lt;BR /&gt; "&amp;lt;/b&amp;gt; {ISOLATION_mi} mi ({ISOLATION_km} km)"&lt;BR /&gt; };&lt;/P&gt;&lt;P&gt;var mtnSymbol = {&lt;BR /&gt; type: "point-3d", // autocasts as new PointSymbol3D()&lt;BR /&gt; symbolLayers: [&lt;BR /&gt; {&lt;BR /&gt; type: "object", // autocasts as new ObjectSymbol3DLayer()&lt;BR /&gt; resource: {&lt;BR /&gt; primitive: "cone"&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; ]&lt;BR /&gt; };&lt;/P&gt;&lt;P&gt;// Create graphics layer and symbol to use for displaying the results of query&lt;BR /&gt; var resultsLayer = new GraphicsLayer();&lt;/P&gt;&lt;P&gt;/*****************************************************************&lt;BR /&gt; * Point QueryTask to URL of feature service&lt;BR /&gt; *****************************************************************/&lt;BR /&gt; var qTask = new QueryTask({&lt;BR /&gt; url: peaksUrl&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;/******************************************************************&lt;BR /&gt; * Set the query parameters to always return geometry and all fields.&lt;BR /&gt; * Returning geometry allows us to display results on the map/view&lt;BR /&gt; ******************************************************************/&lt;BR /&gt; var params = new Query({&lt;BR /&gt; returnGeometry: true,&lt;BR /&gt; outFields: ["*"]&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;var map = new Map({&lt;BR /&gt; basemap: "osm",&lt;BR /&gt; layers: [resultsLayer] // add graphics layer to the map&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;var view = new SceneView({&lt;BR /&gt; map: map,&lt;BR /&gt; container: "viewDiv",&lt;BR /&gt; center: [-100, 38],&lt;BR /&gt; zoom: 4,&lt;BR /&gt; popup: {&lt;BR /&gt; dockEnabled: true,&lt;BR /&gt; dockOptions: {&lt;BR /&gt; position: "top-right",&lt;BR /&gt; breakpoint: false&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;// Call doQuery() each time the button is clicked&lt;BR /&gt; view.when(function() {&lt;BR /&gt; view.ui.add("optionsDiv", "bottom-right");&lt;BR /&gt; document.getElementById("doBtn").addEventListener("click", doQuery);&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;var attributeName = document.getElementById("attSelect");&lt;BR /&gt; var expressionSign = document.getElementById("signSelect");&lt;BR /&gt; var value = document.getElementById("valSelect");&lt;BR /&gt; var attributeName2 = document.getElementById("attSelect2");&lt;BR /&gt; var expressionSign2 = document.getElementById("signSelect2");&lt;BR /&gt; var value2 = document.getElementById("valSelect2");&lt;/P&gt;&lt;P&gt;// Executes each time the button is clicked&lt;BR /&gt; function doQuery() {&lt;BR /&gt; // Clear the results from a previous query&lt;BR /&gt; resultsLayer.removeAll();&lt;BR /&gt; /*********************************************&lt;BR /&gt; *&lt;BR /&gt; * Set the where clause for the query. This can be any valid SQL expression.&lt;BR /&gt; * In this case the inputs from the three drop down menus are used to build&lt;BR /&gt; * the query. For example, if "Elevation", "is greater than", and "10,000 ft"&lt;BR /&gt; * are selected, then the following SQL where clause is built here:&lt;BR /&gt; *&lt;BR /&gt; * params.where = "ELEV_ft &amp;gt; 10000";&lt;BR /&gt; *&lt;BR /&gt; * ELEV_ft is the field name for Elevation and is assigned to the value of the&lt;BR /&gt; * select option in the HTML below. Other operators such as AND, OR, LIKE, etc&lt;BR /&gt; * may also be used here.&lt;BR /&gt; *&lt;BR /&gt; **********************************************/&lt;BR /&gt; params.where =&lt;BR /&gt; (attributeName.value + expressionSign.value + value.value) + "AND" + (attributeName2.value + expressionSign2.value + value2.value) ;&lt;/P&gt;&lt;P&gt;// executes the query and calls getResults() once the promise is resolved&lt;BR /&gt; // promiseRejected() is called if the promise is rejected&lt;BR /&gt; qTask&lt;BR /&gt; .execute(params)&lt;BR /&gt; .then(getResults)&lt;BR /&gt; .catch(promiseRejected);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;// Called each time the promise is resolved&lt;BR /&gt; function getResults(response) {&lt;BR /&gt; // Loop through each of the results and assign a symbol and PopupTemplate&lt;BR /&gt; // to each so they may be visualized on the map&lt;BR /&gt; var peakResults = response.features.map(function(feature) {&lt;BR /&gt; // Sets the symbol of each resulting feature to a cone with a&lt;BR /&gt; // fixed color and width. The height is based on the mountain's elevation&lt;BR /&gt; feature.symbol = {&lt;BR /&gt; type: "point-3d", // autocasts as new PointSymbol3D()&lt;BR /&gt; symbolLayers: [&lt;BR /&gt; {&lt;BR /&gt; type: "object", // autocasts as new ObjectSymbol3DLayer()&lt;BR /&gt; material: {&lt;BR /&gt; color: "green"&lt;BR /&gt; },&lt;BR /&gt; resource: {&lt;BR /&gt; primitive: "cone"&lt;BR /&gt; },&lt;BR /&gt; width: 100000,&lt;BR /&gt; height: feature.attributes.ELEV_m * 100&lt;BR /&gt; }&lt;BR /&gt; ]&lt;BR /&gt; };&lt;/P&gt;&lt;P&gt;feature.popupTemplate = popupTemplate;&lt;BR /&gt; return feature;&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;resultsLayer.addMany(peakResults);&lt;/P&gt;&lt;P&gt;// animate to the results after they are added to the map&lt;BR /&gt; view.goTo(peakResults).then(function() {&lt;BR /&gt; view.popup.open({&lt;BR /&gt; features: peakResults,&lt;BR /&gt; featureMenuOpen: true,&lt;BR /&gt; updateLocationEnabled: true&lt;BR /&gt; });&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;// print the number of results returned to the user&lt;BR /&gt; document.getElementById("printResults").innerHTML =&lt;BR /&gt; peakResults.length + " results found!";&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;// Called each time the promise is rejected&lt;BR /&gt; function promiseRejected(error) {&lt;BR /&gt; console.error("Promise rejected: ", error.message);&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 class="esri-widget" id="optionsDiv"&amp;gt;&lt;BR /&gt; &amp;lt;h2&amp;gt;Prominent Peaks in the U.S.&amp;lt;/h2&amp;gt;&lt;BR /&gt; &amp;lt;select class="esri-widget" id="attSelect"&amp;gt;&lt;BR /&gt; &amp;lt;option value="ELEV_ft"&amp;gt;Elevation&amp;lt;/option&amp;gt;&lt;BR /&gt; &amp;lt;option value="PROMINENCE_ft" selected&amp;gt;Prominence&amp;lt;/option&amp;gt;&lt;BR /&gt; &amp;lt;/select&amp;gt;&lt;BR /&gt; &amp;lt;select class="esri-widget" id="signSelect"&amp;gt;&lt;BR /&gt; &amp;lt;option value="&amp;gt;"&amp;gt;is greater than&amp;lt;/option&amp;gt;&lt;BR /&gt; &amp;lt;option value="&amp;lt;"&amp;gt;is less than&amp;lt;/option&amp;gt;&lt;BR /&gt; &amp;lt;option value="="&amp;gt;is equal to&amp;lt;/option&amp;gt;&lt;BR /&gt; &amp;lt;/select&amp;gt;&lt;BR /&gt; &amp;lt;select class="esri-widget" id="valSelect"&amp;gt;&lt;BR /&gt; &amp;lt;option value="800"&amp;gt;1,000 ft&amp;lt;/option&amp;gt;&lt;BR /&gt; &amp;lt;option value="850"&amp;gt;5,000 ft&amp;lt;/option&amp;gt;&lt;BR /&gt; &amp;lt;option value="10000"&amp;gt;10,000 ft&amp;lt;/option&amp;gt;&lt;BR /&gt; &amp;lt;option value="15000"&amp;gt;15,000 ft&amp;lt;/option&amp;gt;&lt;BR /&gt; &amp;lt;option value="20000"&amp;gt;20,000 ft&amp;lt;/option&amp;gt;&lt;BR /&gt; &amp;lt;/select&amp;gt;&lt;BR /&gt; &amp;lt;select class="esri-widget" id="attSelect2"&amp;gt;&lt;BR /&gt; &amp;lt;option value="ELEV_ft"&amp;gt;Elevation&amp;lt;/option&amp;gt;&lt;BR /&gt; &amp;lt;option value="PROMINENCE_ft" selected&amp;gt;Prominence&amp;lt;/option&amp;gt;&lt;BR /&gt; &amp;lt;/select&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;select class="esri-widget" id="signSelect2"&amp;gt;&lt;BR /&gt; &amp;lt;option value="&amp;gt;"&amp;gt;is greater than&amp;lt;/option&amp;gt;&lt;BR /&gt; &amp;lt;option value="&amp;lt;"&amp;gt;is less than&amp;lt;/option&amp;gt;&lt;BR /&gt; &amp;lt;option value="="&amp;gt;is equal to&amp;lt;/option&amp;gt;&lt;BR /&gt; &amp;lt;/select&amp;gt;&lt;BR /&gt; &amp;lt;select class="esri-widget" id="valSelect2"&amp;gt;&lt;BR /&gt; &lt;BR /&gt; &amp;lt;option value="850"&amp;gt;1,000 ft&amp;lt;/option&amp;gt;&lt;BR /&gt; &amp;lt;option value="950"&amp;gt;5,000 ft&amp;lt;/option&amp;gt;&lt;BR /&gt; &amp;lt;option value="10000"&amp;gt;10,000 ft&amp;lt;/option&amp;gt;&lt;BR /&gt; &amp;lt;option value="15000"&amp;gt;15,000 ft&amp;lt;/option&amp;gt;&lt;BR /&gt; &amp;lt;option value="20000"&amp;gt;20,000 ft&amp;lt;/option&amp;gt;&lt;BR /&gt; &amp;lt;/select&amp;gt;&lt;BR /&gt; &amp;lt;br /&amp;gt;&lt;BR /&gt; &amp;lt;br /&amp;gt;&lt;BR /&gt; &amp;lt;button class="esri-widget" id="doBtn"&amp;gt;Do Query&amp;lt;/button&amp;gt; &amp;lt;br /&amp;gt;&lt;BR /&gt; &amp;lt;p&amp;gt;&amp;lt;span id="printResults"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&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>Sun, 18 Aug 2019 13:23:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-expression/m-p/80291#M7365</guid>
      <dc:creator>anjelinaponkerat</dc:creator>
      <dc:date>2019-08-18T13:23:53Z</dc:date>
    </item>
    <item>
      <title>Re: query expression</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-expression/m-p/80292#M7366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Anjelina,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;You where statement is a not proper. You can not have a "PROMINENCE_ft&amp;gt;800ANDPROMINENCE_ft&amp;gt;850". Where is you required spacing before and after the "AND"?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 18 Aug 2019 19:19:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-expression/m-p/80292#M7366</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2019-08-18T19:19:23Z</dc:date>
    </item>
    <item>
      <title>Re: query expression</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-expression/m-p/80293#M7367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is this true?:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;params.where =&lt;BR /&gt;(attributeName.value + expressionSign.value + value.value)+" AND "+(attributeName2.value + expressionSign2.value + value2.value) ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 18 Aug 2019 19:41:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-expression/m-p/80293#M7367</guid>
      <dc:creator>anjelinaponkerat</dc:creator>
      <dc:date>2019-08-18T19:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: query expression</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-expression/m-p/80294#M7368</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yep that should work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 18 Aug 2019 22:33:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-expression/m-p/80294#M7368</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2019-08-18T22:33:34Z</dc:date>
    </item>
  </channel>
</rss>

