<?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 BUG? Complex Queries Not Editable in Clause Mode? in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/bug-complex-queries-not-editable-in-clause-mode/m-p/296642#M12849</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've noticed that some queries seem to be too complex within the SQL Expression Editor; previously I had issues running a calculation from a datefield that would not work on anything less than 6 months. Here's an example that I'm running into today:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a map that needs to be updated bi-weekly, it's based on the following query:&lt;/P&gt;&lt;P&gt;2 week range &amp;gt;= and &amp;gt;&lt;/P&gt;&lt;P&gt;a diff that calculates one business day turnaround&lt;/P&gt;&lt;P&gt;according to two complaint flags&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;OpenDate &lt;SPAN class="operator token"&gt;&amp;gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'2020-07-27 00:00:00'&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;And&lt;/SPAN&gt; OpenDate &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'2020-08-10 00:00:00'&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;AND&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;DATEDIFF&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Day&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; OpenDate&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; CaseInspectionDate&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; DATEDIFF&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Week&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; OpenDate&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; CaseInspectionDate&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;2&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;lt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;AND&lt;/SPAN&gt; CaseReported &lt;SPAN class="operator token"&gt;IN&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Citizen Complaint'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'City Council'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Then when I go to make a&amp;nbsp;&lt;EM&gt;simple&lt;/EM&gt; edit, changing the string for date:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;OpenDate &lt;SPAN class="operator token"&gt;&amp;gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'2020-08-10 00:00:00'&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;And&lt;/SPAN&gt; OpenDate &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'2020-08-24 00:00:00'&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;AND&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;DATEDIFF&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Day&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; OpenDate&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; CaseInspectionDate&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; DATEDIFF&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Week&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; OpenDate&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; CaseInspectionDate&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;2&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;lt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;AND&lt;/SPAN&gt; CaseReported &lt;SPAN class="operator token"&gt;IN&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Citizen Complaint'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'City Council'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It flips out like so:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="The expression cannot be edited in clause mode, invalid syntax" class="jive-emoji image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/504371_MicrosoftTeams-image.png" /&gt;&lt;/P&gt;&lt;P&gt;Pretty horrible right?&lt;/P&gt;&lt;P&gt;Is this a bug?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now if I were limited to the GUI that would be bad. So I went ahead and used the new mp module in ArcPy, because I'm in the process of automating this map anyway:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy

old_query01 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"OpenDate &amp;gt;= '2020-07-27 00:00:00' And OpenDate &amp;lt; '2020-08-10 00:00:00' AND (DATEDIFF(Day, OpenDate, CaseInspectionDate) - DATEDIFF(Week, OpenDate, CaseInspectionDate) * 2 &amp;lt;= 1 ) AND CaseReported IN ('Citizen Complaint', 'City Council')"&lt;/SPAN&gt;
old_query02 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"OpenDate &amp;gt;= '2020-07-27 00:00:00' And OpenDate &amp;lt; '2020-08-10 00:00:00'"&lt;/SPAN&gt;
old_query03 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"OpenDate &amp;gt;= '2020-07-27 00:00:00' And OpenDate &amp;lt; '2020-08-10 00:00:00' AND CaseReported IN ('Citizen Complaint', 'City Council')"&lt;/SPAN&gt;

new_query01 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"OpenDate &amp;gt;= '2020-08-10 00:00:00' And OpenDate &amp;lt; '2020-08-24 00:00:00' AND (DATEDIFF(Day, OpenDate, CaseInspectionDate) - DATEDIFF(Week, OpenDate, CaseInspectionDate) * 2 &amp;lt;= 1 ) AND CaseReported IN ('Citizen Complaint', 'City Council')"&lt;/SPAN&gt;
new_query02 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"OpenDate &amp;gt;= '2020-08-10 00:00:00' And OpenDate &amp;lt; '2020-08-24 00:00:00'"&lt;/SPAN&gt;
new_query03 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"OpenDate &amp;gt;= '2020-08-10 00:00:00' And OpenDate &amp;lt; '2020-08-24 00:00:00' AND CaseReported IN ('Citizen Complaint', 'City Council')"&lt;/SPAN&gt;

aprx &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ArcGISProject&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;"C:\Users\gisspellblade\Desktop\ArcProjects\SolidWaste_EnergovDemo.aprx"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; m &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; aprx&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;listMaps&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;f&lt;SPAN class="string token"&gt;"Map: {m} Layers"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; lyr &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; m&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;listLayers&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;f&lt;SPAN class="string token"&gt;"\t{lyr.name}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;supports&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"DEFINITIONQUERY"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
            &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Complaint Response One Business Day:"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
                lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;definitionQuery &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; new_query01
                &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;f&lt;SPAN class="string token"&gt;"Defintion changed for {lyr.name}: {lyr.definitionQuery}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
            &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Cose Total: "&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
                lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;definitionQuery &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; new_query02
                &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;f&lt;SPAN class="string token"&gt;"Defintion changed for {lyr.name}: {lyr.definitionQuery}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
            &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Complaint Total: "&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
                lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;definitionQuery &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; new_query03
                &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;f&lt;SPAN class="string token"&gt;"Defintion changed for {lyr.name}: {lyr.definitionQuery}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
aprx&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;save&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Which at first blush, also did nothing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I ran this several times with no resulting changes in the map.&lt;/P&gt;&lt;P&gt;I restarted the program and still nothing.&lt;/P&gt;&lt;P&gt;Then, I left the program closed for more than 10 minutes, and when I get back, I have these results:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Original query preserved, new query added on top of it" class="jive-emoji jive-image image-2 j-img-original" src="https://community.esri.com/legacyfs/online/504372_ArcPyResults.PNG" /&gt;&lt;/P&gt;&lt;P&gt;So now I have three questions:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;If I'm changing the value on &lt;EM&gt;lyr.definitionQuery&lt;/EM&gt;, then I'd think it would be an over-write and not an append? and if&amp;nbsp;&lt;EM&gt;lyr.definitionQuery&lt;/EM&gt; is a read/write; how does one access multiple queries to appropriately delete/add what they need?&lt;UL&gt;&lt;LI&gt;the documentation here is&amp;nbsp;&lt;EM&gt;pretty&amp;nbsp;&lt;/EM&gt;light;&amp;nbsp;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/arcpy/mapping/alphabeticallistofclasses.htm" title="https://pro.arcgis.com/en/pro-app/arcpy/mapping/alphabeticallistofclasses.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Alphabetical list of arcpy.mp classes—ArcGIS Pro | Documentation&lt;/A&gt;&amp;nbsp;unless there's more detailed information lurking just past my level of google-fu&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Why are these values not showing up immediately within the project? and why do I need a long cold restart to view changes made with ArcPy?&lt;UL&gt;&lt;LI&gt;this is an issue that I've seen before of needing to close a project for a ArcPy-derived result to appear in previous Pro versions&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;What's with the GUI not accepting changes to complex queries, or refusing to write them in the first place?&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In ArcGIS Pro 2.6&lt;/P&gt;&lt;P&gt;arcgispro2.6‌&amp;nbsp;arcpy&amp;nbsp;&lt;A href="https://community.esri.com/t5/tag/definition expressions/tg-p" target="_blank"&gt;#definition expressions&lt;/A&gt;‌ &lt;A href="https://community.esri.com/t5/tag/set definition/tg-p" target="_blank"&gt;#set definition&lt;/A&gt;‌ &lt;A href="https://community.esri.com/t5/tag/sql clause/tg-p" target="_blank"&gt;#sql clause&lt;/A&gt;‌ &lt;A href="https://community.esri.com/t5/tag/sql query builder/tg-p" target="_blank"&gt;#sql query builder&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 14:13:52 GMT</pubDate>
    <dc:creator>GIS_Spellblade</dc:creator>
    <dc:date>2021-12-11T14:13:52Z</dc:date>
    <item>
      <title>BUG? Complex Queries Not Editable in Clause Mode?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/bug-complex-queries-not-editable-in-clause-mode/m-p/296642#M12849</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've noticed that some queries seem to be too complex within the SQL Expression Editor; previously I had issues running a calculation from a datefield that would not work on anything less than 6 months. Here's an example that I'm running into today:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a map that needs to be updated bi-weekly, it's based on the following query:&lt;/P&gt;&lt;P&gt;2 week range &amp;gt;= and &amp;gt;&lt;/P&gt;&lt;P&gt;a diff that calculates one business day turnaround&lt;/P&gt;&lt;P&gt;according to two complaint flags&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;OpenDate &lt;SPAN class="operator token"&gt;&amp;gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'2020-07-27 00:00:00'&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;And&lt;/SPAN&gt; OpenDate &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'2020-08-10 00:00:00'&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;AND&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;DATEDIFF&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Day&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; OpenDate&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; CaseInspectionDate&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; DATEDIFF&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Week&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; OpenDate&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; CaseInspectionDate&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;2&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;lt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;AND&lt;/SPAN&gt; CaseReported &lt;SPAN class="operator token"&gt;IN&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Citizen Complaint'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'City Council'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Then when I go to make a&amp;nbsp;&lt;EM&gt;simple&lt;/EM&gt; edit, changing the string for date:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;OpenDate &lt;SPAN class="operator token"&gt;&amp;gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'2020-08-10 00:00:00'&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;And&lt;/SPAN&gt; OpenDate &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'2020-08-24 00:00:00'&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;AND&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;DATEDIFF&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Day&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; OpenDate&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; CaseInspectionDate&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; DATEDIFF&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Week&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; OpenDate&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; CaseInspectionDate&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;2&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;lt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;AND&lt;/SPAN&gt; CaseReported &lt;SPAN class="operator token"&gt;IN&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Citizen Complaint'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'City Council'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It flips out like so:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="The expression cannot be edited in clause mode, invalid syntax" class="jive-emoji image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/504371_MicrosoftTeams-image.png" /&gt;&lt;/P&gt;&lt;P&gt;Pretty horrible right?&lt;/P&gt;&lt;P&gt;Is this a bug?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now if I were limited to the GUI that would be bad. So I went ahead and used the new mp module in ArcPy, because I'm in the process of automating this map anyway:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy

old_query01 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"OpenDate &amp;gt;= '2020-07-27 00:00:00' And OpenDate &amp;lt; '2020-08-10 00:00:00' AND (DATEDIFF(Day, OpenDate, CaseInspectionDate) - DATEDIFF(Week, OpenDate, CaseInspectionDate) * 2 &amp;lt;= 1 ) AND CaseReported IN ('Citizen Complaint', 'City Council')"&lt;/SPAN&gt;
old_query02 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"OpenDate &amp;gt;= '2020-07-27 00:00:00' And OpenDate &amp;lt; '2020-08-10 00:00:00'"&lt;/SPAN&gt;
old_query03 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"OpenDate &amp;gt;= '2020-07-27 00:00:00' And OpenDate &amp;lt; '2020-08-10 00:00:00' AND CaseReported IN ('Citizen Complaint', 'City Council')"&lt;/SPAN&gt;

new_query01 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"OpenDate &amp;gt;= '2020-08-10 00:00:00' And OpenDate &amp;lt; '2020-08-24 00:00:00' AND (DATEDIFF(Day, OpenDate, CaseInspectionDate) - DATEDIFF(Week, OpenDate, CaseInspectionDate) * 2 &amp;lt;= 1 ) AND CaseReported IN ('Citizen Complaint', 'City Council')"&lt;/SPAN&gt;
new_query02 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"OpenDate &amp;gt;= '2020-08-10 00:00:00' And OpenDate &amp;lt; '2020-08-24 00:00:00'"&lt;/SPAN&gt;
new_query03 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"OpenDate &amp;gt;= '2020-08-10 00:00:00' And OpenDate &amp;lt; '2020-08-24 00:00:00' AND CaseReported IN ('Citizen Complaint', 'City Council')"&lt;/SPAN&gt;

aprx &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ArcGISProject&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;"C:\Users\gisspellblade\Desktop\ArcProjects\SolidWaste_EnergovDemo.aprx"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; m &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; aprx&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;listMaps&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;f&lt;SPAN class="string token"&gt;"Map: {m} Layers"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; lyr &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; m&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;listLayers&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;f&lt;SPAN class="string token"&gt;"\t{lyr.name}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;supports&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"DEFINITIONQUERY"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
            &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Complaint Response One Business Day:"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
                lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;definitionQuery &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; new_query01
                &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;f&lt;SPAN class="string token"&gt;"Defintion changed for {lyr.name}: {lyr.definitionQuery}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
            &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Cose Total: "&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
                lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;definitionQuery &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; new_query02
                &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;f&lt;SPAN class="string token"&gt;"Defintion changed for {lyr.name}: {lyr.definitionQuery}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
            &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Complaint Total: "&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
                lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;definitionQuery &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; new_query03
                &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;f&lt;SPAN class="string token"&gt;"Defintion changed for {lyr.name}: {lyr.definitionQuery}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
aprx&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;save&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Which at first blush, also did nothing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I ran this several times with no resulting changes in the map.&lt;/P&gt;&lt;P&gt;I restarted the program and still nothing.&lt;/P&gt;&lt;P&gt;Then, I left the program closed for more than 10 minutes, and when I get back, I have these results:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Original query preserved, new query added on top of it" class="jive-emoji jive-image image-2 j-img-original" src="https://community.esri.com/legacyfs/online/504372_ArcPyResults.PNG" /&gt;&lt;/P&gt;&lt;P&gt;So now I have three questions:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;If I'm changing the value on &lt;EM&gt;lyr.definitionQuery&lt;/EM&gt;, then I'd think it would be an over-write and not an append? and if&amp;nbsp;&lt;EM&gt;lyr.definitionQuery&lt;/EM&gt; is a read/write; how does one access multiple queries to appropriately delete/add what they need?&lt;UL&gt;&lt;LI&gt;the documentation here is&amp;nbsp;&lt;EM&gt;pretty&amp;nbsp;&lt;/EM&gt;light;&amp;nbsp;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/arcpy/mapping/alphabeticallistofclasses.htm" title="https://pro.arcgis.com/en/pro-app/arcpy/mapping/alphabeticallistofclasses.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Alphabetical list of arcpy.mp classes—ArcGIS Pro | Documentation&lt;/A&gt;&amp;nbsp;unless there's more detailed information lurking just past my level of google-fu&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Why are these values not showing up immediately within the project? and why do I need a long cold restart to view changes made with ArcPy?&lt;UL&gt;&lt;LI&gt;this is an issue that I've seen before of needing to close a project for a ArcPy-derived result to appear in previous Pro versions&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;What's with the GUI not accepting changes to complex queries, or refusing to write them in the first place?&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In ArcGIS Pro 2.6&lt;/P&gt;&lt;P&gt;arcgispro2.6‌&amp;nbsp;arcpy&amp;nbsp;&lt;A href="https://community.esri.com/t5/tag/definition expressions/tg-p" target="_blank"&gt;#definition expressions&lt;/A&gt;‌ &lt;A href="https://community.esri.com/t5/tag/set definition/tg-p" target="_blank"&gt;#set definition&lt;/A&gt;‌ &lt;A href="https://community.esri.com/t5/tag/sql clause/tg-p" target="_blank"&gt;#sql clause&lt;/A&gt;‌ &lt;A href="https://community.esri.com/t5/tag/sql query builder/tg-p" target="_blank"&gt;#sql query builder&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:13:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/bug-complex-queries-not-editable-in-clause-mode/m-p/296642#M12849</guid>
      <dc:creator>GIS_Spellblade</dc:creator>
      <dc:date>2021-12-11T14:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: BUG? Complex Queries Not Editable in Clause Mode?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/bug-complex-queries-not-editable-in-clause-mode/m-p/296643#M12850</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;edit---&lt;/P&gt;&lt;P&gt;let's define complex query as a query that cannot be represented in clause mode; in the steps below I referred to it as a lock, which is not the case. That text lets the user know that it can only offer the SQL screen and not the Clause screen.&lt;/P&gt;&lt;P&gt;edit---&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And for one final bit of mystery, after removing the "old" query from each layer, only the queries that can be directly interpreted by the SQL Builder were kept. Removing one of the complex queries removed both of them. I can re-create the old one, and it is accepted, but when I alter the date it rejects it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stuff that works in the builder&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="504380" alt="" class="jive-emoji image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/504380_CaseTotal.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="504381" alt="" class="jive-emoji jive-image image-2 j-img-original" src="https://community.esri.com/legacyfs/online/504381_ComplaintTotal.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now deconstructing the complex one:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;It will build correctly with the old query&lt;BR /&gt;&lt;IMG __jive_id="504382" alt="Build Fine" class="jive-emoji jive-image image-3 j-img-original" src="https://community.esri.com/legacyfs/online/504382_Complaint02.PNG" /&gt;&lt;/LI&gt;&lt;LI&gt;Accepted, and will show&lt;BR /&gt;&lt;IMG __jive_id="504383" alt="" class="jive-emoji jive-image image-4 j-img-original" src="https://community.esri.com/legacyfs/online/504383_Complaint04.PNG" /&gt;&lt;/LI&gt;&lt;LI&gt;When you click edit, it shows a clause that will not edit&lt;BR /&gt;&lt;IMG __jive_id="504384" alt="" class="jive-emoji jive-image image-5 j-img-original" src="https://community.esri.com/legacyfs/online/504384_Complaint003.PNG" /&gt;&lt;/LI&gt;&lt;LI&gt;So let's assume that the above is a lock, it'll unlock if you reduce the complexity; here we keep the date math and drop the flag check, which works&lt;BR /&gt;&lt;IMG __jive_id="504385" alt="" class="jive-emoji image-6 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/504385_Complaint08.PNG" /&gt;&lt;/LI&gt;&lt;LI&gt;But it will not unlock for a similar level of complexity, nor allow an incremental adding of complexity&lt;BR /&gt;&lt;IMG __jive_id="504390" alt="" class="jive-emoji image-8 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/504390_Complaint09.PNG" /&gt;&lt;/LI&gt;&lt;LI&gt;And when you try to write in a query exactly similar except for the date range&lt;BR /&gt;&lt;IMG __jive_id="504389" alt="" class="image-7 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/504389_Complaint07.PNG" style="border: 0px; margin: 2px 0px 0px;" /&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Super odd, no?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2020 18:14:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/bug-complex-queries-not-editable-in-clause-mode/m-p/296643#M12850</guid>
      <dc:creator>GIS_Spellblade</dc:creator>
      <dc:date>2020-08-24T18:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: BUG? Complex Queries Not Editable in Clause Mode?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/bug-complex-queries-not-editable-in-clause-mode/m-p/296644#M12851</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bugs! Lots of Bugs! For anyone else that stumbles on this; these bugs are valid as of 2.6.1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: rgba(0, 0, 0, 0.9); background-color: #ffffff;"&gt;BUG-000133709: 'ArcGIS Pro does not validate complex SQL Queries while SQL Server does'&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;OpenDate &lt;SPAN class="operator token"&gt;&amp;gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'2020-08-24 00:00:00'&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;AND&lt;/SPAN&gt;
OpenDate &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'2020-09-08 00:00:00'&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;AND&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;DATEDIFF&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;
    Day&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; OpenDate&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; CaseInspectionDate&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;
    DATEDIFF&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Week&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; OpenDate&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; CaseInspectionDate&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;2&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;lt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;AND&lt;/SPAN&gt;
    CaseReported &lt;SPAN class="operator token"&gt;IN&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Citizen Complaint'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'City Council'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: rgba(0, 0, 0, 0.9); background-color: #ffffff;"&gt;BUG-000133921: 'GETDATE() does not work inside a DATEADD expression for Definition Queries in ArcGIS Pro but validates in SSMS'&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;DateReported &lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; DATEADD&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;MONTH&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;6&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; GETDATE&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: rgba(0, 0, 0, 0.9); background-color: #ffffff;"&gt;BUG-000133922: 'DATEADD expression for Definition Queries fail with closer time-frames to today's date in ArcGIS Pro but validates in SSMS'&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;DateReported &lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; DATEADD&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;MONTH&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;6&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'2020/09/17'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:13:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/bug-complex-queries-not-editable-in-clause-mode/m-p/296644#M12851</guid>
      <dc:creator>GIS_Spellblade</dc:creator>
      <dc:date>2021-12-11T14:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: BUG? Complex Queries Not Editable in Clause Mode?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/bug-complex-queries-not-editable-in-clause-mode/m-p/296645#M12852</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good you got some of these issues logged with ESRI.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do think however, that some limitations to "Clause Mode" versus "SQL Mode" are logical. It is probably really hard to represent some of the more complex SQL in a sensible way in the "Clause Mode". If you are that much into SQL anyway, why not directly edit in SQL? I personally almost never use "Clause Mode", I much prefer seeing and editing the actual SQL statement. Only rarely do I switch to "Clause Mode". I actually filed an ArcGIS Idea for allowing a preset in the ArcGIS Pro project settings for choosing between Clause or SQL mode. Vote it up if you agree:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/ideas/16164-application-wide-setting-option-to-switch-between-clause-and-sql-mode-for-expressions"&gt;Application wide setting / option to switch between "Clause" and "SQL" mode for expressions&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Sep 2020 17:15:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/bug-complex-queries-not-editable-in-clause-mode/m-p/296645#M12852</guid>
      <dc:creator>MarcoBoeringa</dc:creator>
      <dc:date>2020-09-17T17:15:14Z</dc:date>
    </item>
    <item>
      <title>Re: BUG? Complex Queries Not Editable in Clause Mode?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/bug-complex-queries-not-editable-in-clause-mode/m-p/296646#M12853</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Definitely agree about the limitations of GUI-driven SQL, although there are definitely more products out there pushing the envelope on that front. The issue that I tried documenting above was that outside of clause mode, there are potentially huge SQL limitations that would otherwise be possible in a native SQL environment like SSMS. Having the ability to define things within the definition query makes launching web services easier and gets rid of some of the overhead of having to write those views directly on your database.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also agree that users should have an option of what to toggle as a preference for the SQL queries, upvoted.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Sep 2020 17:59:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/bug-complex-queries-not-editable-in-clause-mode/m-p/296646#M12853</guid>
      <dc:creator>GIS_Spellblade</dc:creator>
      <dc:date>2020-09-17T17:59:40Z</dc:date>
    </item>
  </channel>
</rss>

