<?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: mapservice failing to query in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapservice-failing-to-query/m-p/81792#M7476</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Cam,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;I did not spend the time to change all your field names in your code. Anywhere in your code you are specifying field names you need to ensure that you are using the correct field names for your final layer choice.&lt;/P&gt;&lt;P&gt;i.e id =&amp;nbsp;&lt;SPAN style="color: #000000; background-color: #ffffff; font-size: 14.4px;"&gt;SeismicEvents.id.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 15 Jun 2020 13:54:48 GMT</pubDate>
    <dc:creator>RobertScheitlin__GISP</dc:creator>
    <dc:date>2020-06-15T13:54:48Z</dc:date>
    <item>
      <title>mapservice failing to query</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapservice-failing-to-query/m-p/81789#M7473</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have the following code to filter shake intensity maps by ID. It works fine with this URL --&amp;gt;&amp;nbsp; &lt;A class="link-titled" href="https://services9.arcgis.com/RHVPKKiFTONKtxq3/arcgis/rest/services/USGS_Seismic_Data_v1/FeatureServer/1/" title="https://services9.arcgis.com/RHVPKKiFTONKtxq3/arcgis/rest/services/USGS_Seismic_Data_v1/FeatureServer/1/"&gt;https://services9.arcgis.com/RHVPKKiFTONKtxq3/arcgis/rest/services/USGS_Seismic_Data_v1/FeatureServer/1/&lt;/A&gt;&amp;nbsp;&amp;nbsp;but as soon as I plugin my production mapserver URL of --&amp;gt;&amp;nbsp;&lt;A class="link-titled" href="https://livefeeds.arcgis.com/arcgis/rest/services/LiveFeeds/USGS_Seismic_Data/MapServer/12/" title="https://livefeeds.arcgis.com/arcgis/rest/services/LiveFeeds/USGS_Seismic_Data/MapServer/12/"&gt;https://livefeeds.arcgis.com/arcgis/rest/services/LiveFeeds/USGS_Seismic_Data/MapServer/12/&lt;/A&gt;&amp;nbsp; I immediately get a console error 400 query failing, i.e. below, and the map no longer displays.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;error:&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/496509_pastedImage_2.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;full code:&lt;/STRONG&gt;&lt;/EM&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;Filter features by attribute - 4.15&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.15/esri/themes/light/main.css"&lt;BR /&gt; /&amp;gt;&lt;BR /&gt; &amp;lt;script src="https://js.arcgis.com/4.15/"&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; 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;.id-item:focus {&lt;BR /&gt; background-color: dimgrey;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;.id-item:hover {&lt;BR /&gt; background-color: dimgrey;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;#titleDiv {&lt;BR /&gt; padding: 10px;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;#titleText {&lt;BR /&gt; font-size: 20pt;&lt;BR /&gt; font-weight: 60;&lt;BR /&gt; padding-bottom: 10px;&lt;BR /&gt; }&lt;BR /&gt; &amp;lt;/style&amp;gt;&lt;BR /&gt; &amp;lt;script&amp;gt;&lt;BR /&gt; require([&lt;BR /&gt; "esri/views/MapView",&lt;BR /&gt; "esri/Map",&lt;BR /&gt; "esri/layers/FeatureLayer",&lt;BR /&gt; "esri/widgets/Expand"&lt;BR /&gt; ], function(MapView, Map, FeatureLayer, Expand) {&lt;BR /&gt; let floodLayerView;&lt;/P&gt;&lt;P&gt;const layer = new FeatureLayer({&lt;BR /&gt; url: "https://livefeeds.arcgis.com/arcgis/rest/services/LiveFeeds/USGS_Seismic_Data/MapServer/12",&lt;BR /&gt; outFields: ["*"]&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;const map = new Map({&lt;BR /&gt; basemap: "gray-vector",&lt;BR /&gt; //layers: [layer]&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;const view = new MapView({&lt;BR /&gt; map: map,&lt;BR /&gt; container: "viewDiv",&lt;BR /&gt; center: [-98, 40],&lt;BR /&gt; zoom: 4&lt;BR /&gt; });&lt;BR /&gt; &lt;BR /&gt; layer.definitionExpression = "eventTime &amp;gt;= CURRENT_TIMESTAMP - 30 AND grid_value &amp;gt; 2",&lt;BR /&gt; map.add(layer);&lt;BR /&gt; &lt;BR /&gt; const idNodes = document.querySelectorAll(`.id-item`);&lt;BR /&gt; const idElement = document.getElementById("id-filter");&lt;/P&gt;&lt;P&gt;idElement.addEventListener("click", filterByID);&lt;/P&gt;&lt;P&gt;function filterByID(event) {&lt;BR /&gt; const selectedID = event.target.getAttribute("data-id");&lt;BR /&gt; eqLayerView.filter = {&lt;BR /&gt; where: "id = '" + selectedID + "'"&lt;BR /&gt; };&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;view.whenLayerView(layer).then(function(layerView) {&lt;BR /&gt; eqLayerView = layerView;&lt;/P&gt;&lt;P&gt;eqLayerView.filter = {&lt;BR /&gt; where: "id = ''"&lt;BR /&gt; };&lt;/P&gt;&lt;P&gt;idElement.style.visibility = "visible";&lt;BR /&gt; &lt;BR /&gt; var query = layer.createQuery();&lt;BR /&gt; query.outFields = ["id"];&lt;BR /&gt; query.returnDistinctValues = true;&lt;BR /&gt; query.returnGeometry = false;&lt;BR /&gt; layer.queryFeatures(query).then(function(results){&lt;BR /&gt; results.features.map(function(feat){&lt;BR /&gt; let id = feat.attributes.id;&lt;BR /&gt; let opt = document.createElement("input");&lt;BR /&gt; opt.type = "checkbox";&lt;BR /&gt; let label = document.createElement('label')&lt;BR /&gt; label.innerHTML = id;&lt;BR /&gt; opt.className = "id-item visible-id";&lt;BR /&gt; opt.setAttribute("data-id", id);&lt;/P&gt;&lt;P&gt;idElement.appendChild(opt);&lt;BR /&gt; idElement.appendChild(label);&lt;BR /&gt; });&lt;BR /&gt; });&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="id-filter" class="esri-widget"&amp;gt;&lt;BR /&gt; &amp;lt;/div&amp;gt;&lt;BR /&gt; &amp;lt;div id="viewDiv"&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt; &amp;lt;div id="titleDiv" class="esri-widget"&amp;gt;&lt;BR /&gt; &amp;lt;div id="titleText"&amp;gt;Earthquakes&amp;lt;/div&amp;gt;&lt;BR /&gt; &amp;lt;div&amp;gt;Shake Intensity&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>Mon, 15 Jun 2020 13:24:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapservice-failing-to-query/m-p/81789#M7473</guid>
      <dc:creator>CamCode</dc:creator>
      <dc:date>2020-06-15T13:24:30Z</dc:date>
    </item>
    <item>
      <title>Re: mapservice failing to query</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapservice-failing-to-query/m-p/81790#M7474</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Cam,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Your definitionQuery is not using correct field names.&lt;/P&gt;&lt;P&gt;This would be the correct query text&lt;/P&gt;&lt;P&gt;layer.definitionExpression = "SeismicEvents.eventTime &amp;gt;= CURRENT_TIMESTAMP - 30 AND ShakeIntensity.grid_value &amp;gt; 2",&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jun 2020 13:33:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapservice-failing-to-query/m-p/81790#M7474</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2020-06-15T13:33:01Z</dc:date>
    </item>
    <item>
      <title>Re: mapservice failing to query</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapservice-failing-to-query/m-p/81791#M7475</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for the response, Robert, however I don't think it's that. I have tried running it with that line commented out, and also just tried your change in any case and the console error still persists..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jun 2020 13:43:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapservice-failing-to-query/m-p/81791#M7475</guid>
      <dc:creator>CamCode</dc:creator>
      <dc:date>2020-06-15T13:43:36Z</dc:date>
    </item>
    <item>
      <title>Re: mapservice failing to query</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapservice-failing-to-query/m-p/81792#M7476</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Cam,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;I did not spend the time to change all your field names in your code. Anywhere in your code you are specifying field names you need to ensure that you are using the correct field names for your final layer choice.&lt;/P&gt;&lt;P&gt;i.e id =&amp;nbsp;&lt;SPAN style="color: #000000; background-color: #ffffff; font-size: 14.4px;"&gt;SeismicEvents.id.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jun 2020 13:54:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapservice-failing-to-query/m-p/81792#M7476</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2020-06-15T13:54:48Z</dc:date>
    </item>
    <item>
      <title>Re: mapservice failing to query</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapservice-failing-to-query/m-p/81793#M7477</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK, I see, thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jun 2020 13:57:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapservice-failing-to-query/m-p/81793#M7477</guid>
      <dc:creator>CamCode</dc:creator>
      <dc:date>2020-06-15T13:57:49Z</dc:date>
    </item>
  </channel>
</rss>

