<?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: ArcMap Definition query - Last Month, 2019 and 2020 in Geodatabase Questions</title>
    <link>https://community.esri.com/t5/geodatabase-questions/arcmap-definition-query-last-month-2019-and-2020/m-p/806305#M2911</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Awesome ! this works...Many thanks once again Xander.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jan 2020 01:30:54 GMT</pubDate>
    <dc:creator>timdunlevie1</dc:creator>
    <dc:date>2020-01-16T01:30:54Z</dc:date>
    <item>
      <title>ArcMap Definition query - Last Month, 2019 and 2020</title>
      <link>https://community.esri.com/t5/geodatabase-questions/arcmap-definition-query-last-month-2019-and-2020/m-p/806303#M2909</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Running ArcMap 10.6 and have fc's sitting in a file geodatabase.&lt;/P&gt;&lt;P&gt;Last year I had a set of .lyr files setup with a definition query showing activity for the 'Last Month'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The definition query I used was this:&lt;/P&gt;&lt;P&gt;(EXTRACT(MONTH FROM SEARCH_DATE) = EXTRACT(MONTH FROM CURRENT_DATE)-1) AND EXTRACT(YEAR FROM SEARCH_DATE) = EXTRACT(YEAR FROM CURRENT_DATE)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This worked fine for dates January thru to December in the same year.&lt;/P&gt;&lt;P&gt;However, opening these .lyr files in January 2020 doesn't work correctly.&lt;/P&gt;&lt;P&gt;I basically have to re-design the query to something like this for December 2019 data:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(EXTRACT(MONTH FROM LAB_DATE) = EXTRACT(MONTH FROM CURRENT_DATE)+11) AND EXTRACT(YEAR FROM LAB_DATE) = EXTRACT(YEAR FROM CURRENT_DATE)-1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But then would have to change the filter again to get January 2020 data when we move into February 2020.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a permanent query i can set and not have this issue for 2020 to 2021?&lt;/P&gt;&lt;P&gt;or am i stuck with manually changing them now, then changing again in January 2021?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jan 2020 07:17:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/arcmap-definition-query-last-month-2019-and-2020/m-p/806303#M2909</guid>
      <dc:creator>timdunlevie1</dc:creator>
      <dc:date>2020-01-15T07:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: ArcMap Definition query - Last Month, 2019 and 2020</title>
      <link>https://community.esri.com/t5/geodatabase-questions/arcmap-definition-query-last-month-2019-and-2020/m-p/806304#M2910</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/people/timdun"&gt;timdun&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess you could do something like this, since the date functions available are pretty limited:&lt;/P&gt;&lt;PRE class="line-numbers language-sql"&gt;&lt;CODE&gt;EXTRACT&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;YEAR &lt;SPAN class="keyword token"&gt;FROM&lt;/SPAN&gt; LAB_DATE&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;12&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; EXTRACT&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;MONTH &lt;SPAN class="keyword token"&gt;FROM&lt;/SPAN&gt; LAB_DATE&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; EXTRACT&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;YEAR &lt;SPAN class="keyword token"&gt;FROM&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;CURRENT_DATE&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;12&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; EXTRACT&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;MONTH &lt;SPAN class="keyword token"&gt;FROM&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;CURRENT_DATE&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&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>Wed, 15 Jan 2020 15:53:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/arcmap-definition-query-last-month-2019-and-2020/m-p/806304#M2910</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2020-01-15T15:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: ArcMap Definition query - Last Month, 2019 and 2020</title>
      <link>https://community.esri.com/t5/geodatabase-questions/arcmap-definition-query-last-month-2019-and-2020/m-p/806305#M2911</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Awesome ! this works...Many thanks once again Xander.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2020 01:30:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/arcmap-definition-query-last-month-2019-and-2020/m-p/806305#M2911</guid>
      <dc:creator>timdunlevie1</dc:creator>
      <dc:date>2020-01-16T01:30:54Z</dc:date>
    </item>
    <item>
      <title>Re: ArcMap Definition query - Last Month, 2019 and 2020</title>
      <link>https://community.esri.com/t5/geodatabase-questions/arcmap-definition-query-last-month-2019-and-2020/m-p/806306#M2912</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/people/timdun"&gt;timdun&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You're welcome. Glad it works!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2020 02:57:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/arcmap-definition-query-last-month-2019-and-2020/m-p/806306#M2912</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2020-01-16T02:57:44Z</dc:date>
    </item>
  </channel>
</rss>

