<?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 Using Calculate value for an sql statement in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/using-calculate-value-for-an-sql-statement/m-p/1254035#M64958</link>
    <description>&lt;P&gt;I'm trying to use calculate value to create an sql expression for the Make Query Table Tool, and I've reached a point where I don't know why it's not working.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's my calculate value:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Expression = sqEX("%Name%")

def sqEX(Table):
	fEx= "{}.Owner IS NOT NULL AND {}.Owner NOT LIKE '%FLO%'".format(*Table)
	return fEx&lt;/LI-CODE&gt;&lt;P&gt;And this is the error message I'm getting back:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;Executing (Calculate Value):&lt;/P&gt;&lt;P&gt;CalculateValue sqEX("ssSystemValve") "def sqEX(Table):&lt;BR /&gt;fEx= "{}.Owner IS NOT NULL AND {}.Owner NOT LIKE '%FLO%'".format(*Table)&lt;BR /&gt;return fEx"&lt;/P&gt;&lt;P&gt;"SQL Expression"&lt;BR /&gt;Start Time: Wednesday, February 1, 2023 11:41:31 AM&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Value = s.Owner IS NOT NULL AND s.Owner NOT LIKE '%FLO%'&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;As you can see, the expression is showing the variable from the name field correctly, but then not passing it correctly to the string... I think it has something to do with the asterisk, but if I don't have that, it fails because there are two arguments in my format... thing. Do I need to write Table twice? Is there some other less stupid way to fix this problem?&lt;/P&gt;</description>
    <pubDate>Wed, 01 Feb 2023 20:00:41 GMT</pubDate>
    <dc:creator>KitTompkins</dc:creator>
    <dc:date>2023-02-01T20:00:41Z</dc:date>
    <item>
      <title>Using Calculate value for an sql statement</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/using-calculate-value-for-an-sql-statement/m-p/1254035#M64958</link>
      <description>&lt;P&gt;I'm trying to use calculate value to create an sql expression for the Make Query Table Tool, and I've reached a point where I don't know why it's not working.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's my calculate value:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Expression = sqEX("%Name%")

def sqEX(Table):
	fEx= "{}.Owner IS NOT NULL AND {}.Owner NOT LIKE '%FLO%'".format(*Table)
	return fEx&lt;/LI-CODE&gt;&lt;P&gt;And this is the error message I'm getting back:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;Executing (Calculate Value):&lt;/P&gt;&lt;P&gt;CalculateValue sqEX("ssSystemValve") "def sqEX(Table):&lt;BR /&gt;fEx= "{}.Owner IS NOT NULL AND {}.Owner NOT LIKE '%FLO%'".format(*Table)&lt;BR /&gt;return fEx"&lt;/P&gt;&lt;P&gt;"SQL Expression"&lt;BR /&gt;Start Time: Wednesday, February 1, 2023 11:41:31 AM&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Value = s.Owner IS NOT NULL AND s.Owner NOT LIKE '%FLO%'&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;As you can see, the expression is showing the variable from the name field correctly, but then not passing it correctly to the string... I think it has something to do with the asterisk, but if I don't have that, it fails because there are two arguments in my format... thing. Do I need to write Table twice? Is there some other less stupid way to fix this problem?&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 20:00:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/using-calculate-value-for-an-sql-statement/m-p/1254035#M64958</guid>
      <dc:creator>KitTompkins</dc:creator>
      <dc:date>2023-02-01T20:00:41Z</dc:date>
    </item>
    <item>
      <title>Re: Using Calculate value for an sql statement</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/using-calculate-value-for-an-sql-statement/m-p/1254056#M64965</link>
      <description>&lt;P&gt;With python 3, f strings seem to work much more reliably with string substitutions like this.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Expression = sqEX("%Name%")

def sqEX(Table):
	fEx= f"{Table}.Owner IS NOT NULL AND {Table}.Owner NOT LIKE '%FLO%'"
	return fEx&lt;/LI-CODE&gt;&lt;P&gt;Since your code is assigning %Name% = 'ssSystemValve', I just substituted that for testing:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RhettZufelt_0-1675283517985.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/61887iF2FDACD2CCE51B20/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RhettZufelt_0-1675283517985.png" alt="RhettZufelt_0-1675283517985.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;R_&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 20:32:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/using-calculate-value-for-an-sql-statement/m-p/1254056#M64965</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2023-02-01T20:32:50Z</dc:date>
    </item>
  </channel>
</rss>

