<?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>idea CASE Statements in Definition Query in ArcGIS Pro Ideas</title>
    <link>https://community.esri.com/t5/arcgis-pro-ideas/case-statements-in-definition-query/idi-p/1233445</link>
    <description>&lt;P&gt;I'd like to see support for CASE statements in a Definition Query, particularly where the data is in an Enterprise Geodatabase (SDE) with a database engine that does support this sort of query.&lt;/P&gt;</description>
    <pubDate>Fri, 18 Nov 2022 22:22:04 GMT</pubDate>
    <dc:creator>MatthewGeorge</dc:creator>
    <dc:date>2022-11-18T22:22:04Z</dc:date>
    <item>
      <title>CASE Statements in Definition Query</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/case-statements-in-definition-query/idi-p/1233445</link>
      <description>&lt;P&gt;I'd like to see support for CASE statements in a Definition Query, particularly where the data is in an Enterprise Geodatabase (SDE) with a database engine that does support this sort of query.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2022 22:22:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/case-statements-in-definition-query/idi-p/1233445</guid>
      <dc:creator>MatthewGeorge</dc:creator>
      <dc:date>2022-11-18T22:22:04Z</dc:date>
    </item>
    <item>
      <title>Re: CASE Statements in Definition Query</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/case-statements-in-definition-query/idc-p/1233516#M22190</link>
      <description>&lt;P&gt;Can you give us a&amp;nbsp;hypothetical example?&lt;/P&gt;&lt;P&gt;When I’ve used CASE in Oracle SQL, it’s usually in the SELECT clause in a full-blown query, not in the WHERE clause expression (a definition query essentially being a WHERE clause).&lt;/P&gt;</description>
      <pubDate>Sun, 20 Nov 2022 00:03:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/case-statements-in-definition-query/idc-p/1233516#M22190</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2022-11-20T00:03:30Z</dc:date>
    </item>
    <item>
      <title>Re: CASE Statements in Definition Query</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/case-statements-in-definition-query/idc-p/1233544#M22191</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/351335"&gt;@Bud&lt;/a&gt;&lt;/P&gt;&lt;P&gt;Example as follows:&lt;/P&gt;&lt;PRE&gt;SomeField = CASE
    WHEN MONTH(GETDATE()) &amp;gt;= 8 THEN CONCAT(YEAR(GETDATE()), "-", YEAR(GETDATE())+1)
    ELSE CONCAT(YEAR(GETDATE())-1, "-", YEAR(GETDATE()))
END&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Nov 2022 23:01:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/case-statements-in-definition-query/idc-p/1233544#M22191</guid>
      <dc:creator>MatthewGeorge</dc:creator>
      <dc:date>2022-11-19T23:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: CASE Statements in Definition Query</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/case-statements-in-definition-query/idc-p/1233545#M22192</link>
      <description>&lt;OL&gt;&lt;LI&gt;I don't think I understand how you'd use that in a definition query. It doesn't have a &lt;A href="https://www.orafaq.com/wiki/Predicate" target="_self"&gt;predicate&lt;/A&gt;, does it? For example: WHERE A = B, or something like that.&lt;/LI&gt;&lt;LI&gt;Would putting your logic into a subquery help?&lt;/LI&gt;&lt;LI&gt;What database are you using?&lt;/LI&gt;&lt;LI&gt;Doesn't the definition query use &lt;U&gt;&lt;EM&gt;native&lt;/EM&gt;&lt;/U&gt;&amp;nbsp;SQL, meaning, it would support any SQL functionality that the database supports?&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;I'd be interesting in knowing what the full use case is.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unrelated, but the notes in this idea might interest you:&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-pro-questions/training-course-on-sql-in-arcgis-pro/m-p/1196081" target="_self"&gt;Training course on SQL in ArcGIS Pro&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Nov 2022 01:31:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/case-statements-in-definition-query/idc-p/1233545#M22192</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2022-11-20T01:31:51Z</dc:date>
    </item>
    <item>
      <title>Re: CASE Statements in Definition Query</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/case-statements-in-definition-query/idc-p/1233551#M22193</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/351335"&gt;@Bud&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We have a dataset with a field that defines the season of operations which is basically the years that a season spans concatenated plus a suffix, i.e. 2022-2023_&amp;lt;suffix&amp;gt;. A season starts in August, hence the month check in my example. That exact query works from SSMS (obviously this means we are using SQL Server) when I query the versioned view or business table, for example:&lt;/P&gt;&lt;P&gt;SELECT Field1, Field2, Field3&lt;/P&gt;&lt;P&gt;FROM SomeTable&lt;/P&gt;&lt;P&gt;WHERE &amp;lt;see previous example&amp;gt;&lt;/P&gt;&lt;P&gt;It does have a predicate because the case statement returns the season code which is then checked against SomeField.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Nov 2022 23:39:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/case-statements-in-definition-query/idc-p/1233551#M22193</guid>
      <dc:creator>MatthewGeorge</dc:creator>
      <dc:date>2022-11-19T23:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: CASE Statements in Definition Query</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/case-statements-in-definition-query/idc-p/1233552#M22194</link>
      <description>&lt;P&gt;Interesting.&amp;nbsp;I think I get it now. I hadn't seen CASE used that way before.&lt;/P&gt;&lt;P&gt;I wonder why that doesn't currently work in ArcGIS Pro definition queries. If it's native &lt;U&gt;SQL Server&lt;/U&gt; SQL, you'd think it would work. I don't see why ArcGIS Pro would treat it any differently than [WHERE] 1 = 1, or some other typical predicate.&lt;/P&gt;</description>
      <pubDate>Sun, 20 Nov 2022 00:15:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/case-statements-in-definition-query/idc-p/1233552#M22194</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2022-11-20T00:15:52Z</dc:date>
    </item>
    <item>
      <title>Re: CASE Statements in Definition Query</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/case-statements-in-definition-query/idc-p/1233553#M22195</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/351335"&gt;@Bud&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I should add that the idea is to dynamically return the current season rather than having to explicitly set the current season as it changes.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Nov 2022 23:45:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/case-statements-in-definition-query/idc-p/1233553#M22195</guid>
      <dc:creator>MatthewGeorge</dc:creator>
      <dc:date>2022-11-19T23:45:31Z</dc:date>
    </item>
    <item>
      <title>Re: CASE Statements in Definition Query</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/case-statements-in-definition-query/idc-p/1233554#M22196</link>
      <description>&lt;P&gt;I wonder if you could post a question on Stack Overflow or DBA Stack Exchange, with details like this:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;You are using software that has a limitation where using the &lt;U&gt;CASE in the predicate&lt;/U&gt; directly in the WHERE clause expression doesn't work.&lt;/LI&gt;&lt;LI&gt;So, is there a way to do what you want, using &lt;U&gt;CASE in the predicate&lt;/U&gt;, but not directly in the WHERE clause? For example, could you wrap it in a subquery?&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;BR /&gt;A long shot:&lt;BR /&gt;I wonder, is it actually a&amp;nbsp;&lt;U&gt;&lt;EM&gt;bug&lt;/EM&gt;&lt;/U&gt; in ArcGIS Pro -- specifically a bug with how it handles definition queries on &lt;U&gt;&lt;EM&gt;versioned&lt;/EM&gt;&lt;/U&gt; data? Does it work on an unversioned table?&lt;/P&gt;&lt;P&gt;I ask because I had a similar issue:&lt;BR /&gt;Using Oracle SDE.ST_GEOMETRY functions in a defection query or attribute table doesn't work -- due to a bug with versioning in ArcGIS Pro. But if I wrap it in a subquery, then it works fine. Or if the data is unversioned, it works fine too.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://gis.stackexchange.com/questions/422622/use-sde-st-geometry-functions-in-select-by-attributes-window" target="_self"&gt;Use SDE.ST_GEOMETRY functions in Select by Attributes window&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-questions/find-multi-part-features-using-sql-st-geometry/m-p/1186466" target="_self"&gt;Find multi-part features using SQL (ST_GEOMETRY)&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;Esri Canada Case:&amp;nbsp;03080875&lt;/LI&gt;&lt;LI&gt;Bug Report:&amp;nbsp;BUG-000150273&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;If you submit a case to support, and it turns out to be a bug, I suspect a bug would get fixed&amp;nbsp;&amp;nbsp;before an idea would get implemented,.&lt;/P&gt;</description>
      <pubDate>Sun, 20 Nov 2022 01:33:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/case-statements-in-definition-query/idc-p/1233554#M22196</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2022-11-20T01:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: CASE Statements in Definition Query</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/case-statements-in-definition-query/idc-p/1233555#M22197</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/351335"&gt;@Bud&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for that, I hadn't thought to test out wrapping it in a sub query. Will give that a go when I'm back in the office.&lt;/P&gt;&lt;P&gt;I haven't tested it on nonversioned tables either so will give that a go as well to confirm if it's a bug or not.&lt;/P&gt;</description>
      <pubDate>Sun, 20 Nov 2022 00:23:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/case-statements-in-definition-query/idc-p/1233555#M22197</guid>
      <dc:creator>MatthewGeorge</dc:creator>
      <dc:date>2022-11-20T00:23:01Z</dc:date>
    </item>
    <item>
      <title>Re: CASE Statements in Definition Query</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/case-statements-in-definition-query/idc-p/1233562#M22199</link>
      <description>&lt;P&gt;For what it's worth, your original syntax seems to work fine on Oracle tables in ArcGIS Pro, both on versioned and unversioned tables:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;FIELD1 = (case WHEN 1=1 THEN FIELD1 end) &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bud_0-1668904644020.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/56432i09BEACE5F8540637/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bud_0-1668904644020.png" alt="Bud_0-1668904644020.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The brackets were just for legibility. They're not a subquery. It works without the brackets too:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;FIELD1 = case WHEN 1=1 THEN FIELD1 end&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Oracle 18c; 10.7.1 EGDB; ArcGIS Pro 2.6.8&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Nov 2022 00:54:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/case-statements-in-definition-query/idc-p/1233562#M22199</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2022-11-20T00:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: CASE Statements in Definition Query</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/case-statements-in-definition-query/idc-p/1233563#M22200</link>
      <description>&lt;P&gt;Related post:&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/definition-query-sql-shouldn-t-autocomplete-when/idi-p/1233559" target="_self"&gt;Definition Query SQL shouldn't autocomplete WHEN to WHENEVER&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Nov 2022 01:04:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/case-statements-in-definition-query/idc-p/1233563#M22200</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2022-11-20T01:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: CASE Statements in Definition Query</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/case-statements-in-definition-query/idc-p/1233565#M22201</link>
      <description>&lt;P&gt;For our notes, here's an example of your syntax working in SQL Server (the test has nothing to do with ArcGIS Pro):&lt;/P&gt;&lt;P&gt;&lt;A href="https://dbfiddle.uk/shBxoaUj" target="_blank" rel="noopener"&gt;https://dbfiddle.uk/shBxoaUj&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bud_0-1668906696036.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/56433i600DF719CB76DC05/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bud_0-1668906696036.png" alt="Bud_0-1668906696036.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Nov 2022 01:13:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/case-statements-in-definition-query/idc-p/1233565#M22201</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2022-11-20T01:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: CASE Statements in Definition Query</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/case-statements-in-definition-query/idc-p/1235738#M22298</link>
      <description>&lt;P&gt;How'd it turn out?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2022 02:14:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/case-statements-in-definition-query/idc-p/1235738#M22298</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2022-11-29T02:14:19Z</dc:date>
    </item>
    <item>
      <title>Re: CASE Statements in Definition Query</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/case-statements-in-definition-query/idc-p/1235816#M22300</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/351335"&gt;@Bud&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sub query didn't work but I just realised I didn't test it against non-versioned data so will give that a try tomorrow.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2022 11:05:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/case-statements-in-definition-query/idc-p/1235816#M22300</guid>
      <dc:creator>MatthewGeorge</dc:creator>
      <dc:date>2022-11-29T11:05:32Z</dc:date>
    </item>
  </channel>
</rss>

