<?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 Use a SQL expression inside a Python or Arcade field calculation in ArcGIS Pro Ideas</title>
    <link>https://community.esri.com/t5/arcgis-pro-ideas/use-a-sql-expression-inside-a-python-or-arcade/idi-p/1281871</link>
    <description>&lt;P&gt;&lt;EM&gt;ArcGIS Pro 3.1.1&lt;/EM&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;EM&gt;Mobile geodatabase,&lt;/EM&gt;&lt;/LI&gt;&lt;LI&gt;&lt;EM&gt;File geodatabase,&lt;/EM&gt;&lt;/LI&gt;&lt;LI&gt;&lt;EM&gt;Or enterprise geodatabase that is registered as versioned;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;U&gt;option to move edits to base&lt;/U&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(SQL field calculations not supported on versioned data):&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;For cases where we would rather use SQL than Python or Arcade:&lt;BR /&gt;&lt;SPAN&gt;Could functionality be added so that we can generate a value using a SQL expression -- that would be returned back to the Field Calculator geoprocessing tool?&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bud_0-1682349649755.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/68887i78FB1F979DDEEA79/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bud_0-1682349649755.png" alt="Bud_0-1682349649755.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;For example, if I already have a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://i.stack.imgur.com/aC6pb.png" target="_self" rel="nofollow noopener noreferrer"&gt;complex SQL CASE expression&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;written from a different use case, I don't want to re-write it in Python or Arcade. I'd rather just use the SQL as-is instead,&amp;nbsp;to save time and avoid mistakes.&lt;/P&gt;&lt;P&gt;I'm aware that it's possible to create a SQL database view, join it to the FC attribute table, and do a field calculation to bring in the joined field value. But that's pretty cumbersome for a one-off calculation. So I'm wondering if we could use the SQL expression directly in a Python or Arcade field calculation instead.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Related ideas:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/virtual-attributes-ad-hoc/idi-p/1276471" target="_self"&gt;Virtual Attributes (ad hoc)&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/mobile-geodatabase-calculate-field-using-sql/idi-p/1272248" target="_self"&gt;Mobile Geodatabase — Calculate field using SQL&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/mobile-geodatabase-query-layers/idi-p/1237539" target="_self"&gt;Mobile geodatabase query layers&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/file-geodatabase-calculate-field-using-sql/idi-p/1279480" target="_self"&gt;File Geodatabase — Calculate field using SQL&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/file-geodatabase-query-layers/idi-p/1237538" target="_self"&gt;File geodatabase query layers&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-enterprise-ideas/use-sql-for-field-calculations-on-versioned-data/idc-p/1280047#M3271" target="_self"&gt;Use SQL for field calculations on versioned data (option to move edits to base)&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;</description>
    <pubDate>Mon, 24 Apr 2023 15:23:35 GMT</pubDate>
    <dc:creator>Bud</dc:creator>
    <dc:date>2023-04-24T15:23:35Z</dc:date>
    <item>
      <title>Use a SQL expression inside a Python or Arcade field calculation</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/use-a-sql-expression-inside-a-python-or-arcade/idi-p/1281871</link>
      <description>&lt;P&gt;&lt;EM&gt;ArcGIS Pro 3.1.1&lt;/EM&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;EM&gt;Mobile geodatabase,&lt;/EM&gt;&lt;/LI&gt;&lt;LI&gt;&lt;EM&gt;File geodatabase,&lt;/EM&gt;&lt;/LI&gt;&lt;LI&gt;&lt;EM&gt;Or enterprise geodatabase that is registered as versioned;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;U&gt;option to move edits to base&lt;/U&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(SQL field calculations not supported on versioned data):&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;For cases where we would rather use SQL than Python or Arcade:&lt;BR /&gt;&lt;SPAN&gt;Could functionality be added so that we can generate a value using a SQL expression -- that would be returned back to the Field Calculator geoprocessing tool?&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bud_0-1682349649755.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/68887i78FB1F979DDEEA79/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bud_0-1682349649755.png" alt="Bud_0-1682349649755.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;For example, if I already have a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://i.stack.imgur.com/aC6pb.png" target="_self" rel="nofollow noopener noreferrer"&gt;complex SQL CASE expression&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;written from a different use case, I don't want to re-write it in Python or Arcade. I'd rather just use the SQL as-is instead,&amp;nbsp;to save time and avoid mistakes.&lt;/P&gt;&lt;P&gt;I'm aware that it's possible to create a SQL database view, join it to the FC attribute table, and do a field calculation to bring in the joined field value. But that's pretty cumbersome for a one-off calculation. So I'm wondering if we could use the SQL expression directly in a Python or Arcade field calculation instead.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Related ideas:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/virtual-attributes-ad-hoc/idi-p/1276471" target="_self"&gt;Virtual Attributes (ad hoc)&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/mobile-geodatabase-calculate-field-using-sql/idi-p/1272248" target="_self"&gt;Mobile Geodatabase — Calculate field using SQL&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/mobile-geodatabase-query-layers/idi-p/1237539" target="_self"&gt;Mobile geodatabase query layers&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/file-geodatabase-calculate-field-using-sql/idi-p/1279480" target="_self"&gt;File Geodatabase — Calculate field using SQL&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/file-geodatabase-query-layers/idi-p/1237538" target="_self"&gt;File geodatabase query layers&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-enterprise-ideas/use-sql-for-field-calculations-on-versioned-data/idc-p/1280047#M3271" target="_self"&gt;Use SQL for field calculations on versioned data (option to move edits to base)&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Mon, 24 Apr 2023 15:23:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/use-a-sql-expression-inside-a-python-or-arcade/idi-p/1281871</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2023-04-24T15:23:35Z</dc:date>
    </item>
  </channel>
</rss>

