<?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 ArcPy ExportReport Definition Query in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-exportreport-definition-query/m-p/268166#M20665</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I wrote some code to run on my server that will automatically generate reports from a file geodatabase using several .rlf files that have definition queries within the .rlf files. The code runs flawlessly and now I'm trying to improve it by reducing the number of .rlf files I have to use by adding the definition queries to python within the ExportReport function. I'm having a heck of a time figuring out how to get this to work correctly. I have read over several posts from other users and came across this documentation &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/python/specifying-a-query.htm"&gt;Specifying a query in Python&lt;/A&gt;. This documentation is exactly what I'm trying to do however I can not figure out how to do it correctly. I would deeply appreciate it if someone could lend a hand and get this working for me so I can dissect it and play around some to understand the syntax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SQL Expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Date &amp;gt; CURRENT_DATE-8 AND Area = 'Central'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Python:&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ExportReport&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lyr&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;dirname&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;abspath&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;__file__&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'\\'&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Report_Templates'&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'\\'&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Test_Report.rlf'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; r'D&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;\FTP Files\Reports\Test&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;pdf&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; DEFINITION_QUERY&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; report_definition_query&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; What do I add here?&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;/P&gt;&lt;H1 class="" style="color: #4d4d4d; background-color: #fefefe; font-weight: 500; font-size: 2.375em; margin: 0em 0px 6px;"&gt;&lt;/H1&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 Feb 2019 03:28:43 GMT</pubDate>
    <dc:creator>JeremyMoore3</dc:creator>
    <dc:date>2019-02-06T03:28:43Z</dc:date>
    <item>
      <title>ArcPy ExportReport Definition Query</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-exportreport-definition-query/m-p/268166#M20665</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I wrote some code to run on my server that will automatically generate reports from a file geodatabase using several .rlf files that have definition queries within the .rlf files. The code runs flawlessly and now I'm trying to improve it by reducing the number of .rlf files I have to use by adding the definition queries to python within the ExportReport function. I'm having a heck of a time figuring out how to get this to work correctly. I have read over several posts from other users and came across this documentation &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/python/specifying-a-query.htm"&gt;Specifying a query in Python&lt;/A&gt;. This documentation is exactly what I'm trying to do however I can not figure out how to do it correctly. I would deeply appreciate it if someone could lend a hand and get this working for me so I can dissect it and play around some to understand the syntax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SQL Expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Date &amp;gt; CURRENT_DATE-8 AND Area = 'Central'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Python:&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ExportReport&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lyr&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;dirname&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;abspath&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;__file__&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'\\'&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Report_Templates'&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'\\'&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Test_Report.rlf'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; r'D&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;\FTP Files\Reports\Test&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;pdf&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; DEFINITION_QUERY&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; report_definition_query&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; What do I add here?&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;/P&gt;&lt;H1 class="" style="color: #4d4d4d; background-color: #fefefe; font-weight: 500; font-size: 2.375em; margin: 0em 0px 6px;"&gt;&lt;/H1&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Feb 2019 03:28:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-exportreport-definition-query/m-p/268166#M20665</guid>
      <dc:creator>JeremyMoore3</dc:creator>
      <dc:date>2019-02-06T03:28:43Z</dc:date>
    </item>
  </channel>
</rss>

