<?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: Cannot use SQL CAST function with layer.definitionExpression but it work fine with query builder in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cannot-use-sql-cast-function-with-layer/m-p/1162941#M76968</link>
    <description>&lt;P&gt;You can't use these functions in the definition expression either. CAST is supposed to be the more basic way to do this in SQL...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 11 Apr 2022 07:18:10 GMT</pubDate>
    <dc:creator>FLORENTDEWAZIERES</dc:creator>
    <dc:date>2022-04-11T07:18:10Z</dc:date>
    <item>
      <title>Cannot use SQL CAST function with layer.definitionExpression but it work fine with query builder</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cannot-use-sql-cast-function-with-layer/m-p/1161978#M76945</link>
      <description>&lt;P&gt;Hi I wonder if someone had the same issue.&lt;/P&gt;&lt;P&gt;I'm working with features who needs to be filtered.&lt;/P&gt;&lt;P&gt;I need to use the definition expression : &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-SceneLayer.html#definitionExpression" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-SceneLayer.html#definitionExpression&lt;/A&gt;&lt;/P&gt;&lt;P&gt;My problem is i want to use ISO dates so i'm using moment to get the iso and try to use :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="sql"&gt;date &amp;lt; CAST('2019-12-31T23:00:00.000Z' AS DATE)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It worked fine with query builder and also definition query in pro so im assuming it work on JS apis definitonExpression to but it said i use a non standard function.&lt;/P&gt;&lt;P&gt;I'm able to find a workaround by reformating my dates after convert with the .toIsoString() funciton and using but i still want to be clean and only convert to iso / sending a cast as date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const dateMax = '2019-12-31 23:00:00.000'
layer.definitionExpression = `dateStart &amp;lt; timestamp '${dateMax}'`&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If anyone can help on this subject...&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2022 15:14:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cannot-use-sql-cast-function-with-layer/m-p/1161978#M76945</guid>
      <dc:creator>FLORENTDEWAZIERES</dc:creator>
      <dc:date>2022-04-08T15:14:25Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot use SQL CAST function with layer.definitionExpression but it work fine with query builder</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cannot-use-sql-cast-function-with-layer/m-p/1162811#M76965</link>
      <description>&lt;P&gt;I'm guessing it isn't working because your datastore is using a different RDBMS than your expecting.&lt;/P&gt;&lt;P&gt;If it's using PostGRE you could try the&amp;nbsp;&lt;SPAN&gt;TO_DATE() or TO_TIMESTAMP() function. TO_DATE is just the DATE and TO_TIMESTAMP is (you guessed it) date and time, if you need to be that specific.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If it's SQL Server you could try CONVERT()&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Apr 2022 08:03:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cannot-use-sql-cast-function-with-layer/m-p/1162811#M76965</guid>
      <dc:creator>KimberlyGarbade</dc:creator>
      <dc:date>2022-04-09T08:03:29Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot use SQL CAST function with layer.definitionExpression but it work fine with query builder</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cannot-use-sql-cast-function-with-layer/m-p/1162941#M76968</link>
      <description>&lt;P&gt;You can't use these functions in the definition expression either. CAST is supposed to be the more basic way to do this in SQL...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 07:18:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cannot-use-sql-cast-function-with-layer/m-p/1162941#M76968</guid>
      <dc:creator>FLORENTDEWAZIERES</dc:creator>
      <dc:date>2022-04-11T07:18:10Z</dc:date>
    </item>
  </channel>
</rss>

