<?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: Concatenate expressions issue in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/concatenate-expressions-issue/m-p/406388#M32005</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;THANKS DAN....that worked great....still learning day by day here.....have a great Thanksgiving.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Nov 2016 16:48:09 GMT</pubDate>
    <dc:creator>jaykapalczynski</dc:creator>
    <dc:date>2016-11-23T16:48:09Z</dc:date>
    <item>
      <title>Concatenate expressions issue</title>
      <link>https://community.esri.com/t5/python-questions/concatenate-expressions-issue/m-p/406385#M32002</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have two expressions that work independently but cant get the syntax correct to put them together.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;expression1 = "trailblazers = 'No' OR regulations = 'No' OR safteysign = 'No'"&lt;/P&gt;&lt;P&gt;expression2 = "date &amp;gt;= " + "'%s'" %startdate + " AND " + "date &amp;lt;= " + "'%s'" %enddate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried this:&lt;/P&gt;&lt;P&gt;expression3 = expression2 + ' AND ' + expression1&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;expression3 = expression2 +&amp;nbsp;" AND "&amp;nbsp;+ expression1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;expression3 = "date &amp;gt;= " + "'%s'" %startdate + " AND " + "date &amp;lt;= " + "'%s'" %enddate + " AND " +&amp;nbsp; "trailblazers = 'No' OR regulations = 'No' OR safteysign = 'No'"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I run expression3 it seems to ignore expression2 and gives me all the dates not the ones specified. &amp;nbsp;Confused because when I run expression1 and expression2 individually they do their job.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thoughts?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Nov 2016 16:12:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/concatenate-expressions-issue/m-p/406385#M32002</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2016-11-23T16:12:03Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate expressions issue</title>
      <link>https://community.esri.com/t5/python-questions/concatenate-expressions-issue/m-p/406386#M32003</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are many more ways that you could do the formatting, but I won't touch on that....but make sure you "math" is correct.....maybe add parenthesis in places?, e.g.&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;expression1 = "(trailblazers = 'No' OR regulations = 'No' OR safteysign = 'No')"&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;also, use print statements to see what the variables are actually storing.&amp;nbsp; And it's always good to test manually to see if you are getting the correct results.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Nov 2016 16:25:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/concatenate-expressions-issue/m-p/406386#M32003</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2016-11-23T16:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate expressions issue</title>
      <link>https://community.esri.com/t5/python-questions/concatenate-expressions-issue/m-p/406387#M32004</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't know what you are going to do with this, but it will get messy if you don't start using brackets to enclose conditions.. As an example... not necessarily a solution to your problem... try to formulate conditions and hard to manage strings using formatting options designed to facilitate the process... the following is an example&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; ex3 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"({}) AND ({})"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;expression1&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; expression2&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; ex3
&lt;SPAN class="string token"&gt;"(trailblazers = 'No' OR regulations = 'No' OR safteysign = 'No') AND (date &amp;gt;= '1' AND date &amp;lt;= '2')"&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:29:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/concatenate-expressions-issue/m-p/406387#M32004</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T18:29:25Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate expressions issue</title>
      <link>https://community.esri.com/t5/python-questions/concatenate-expressions-issue/m-p/406388#M32005</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;THANKS DAN....that worked great....still learning day by day here.....have a great Thanksgiving.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Nov 2016 16:48:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/concatenate-expressions-issue/m-p/406388#M32005</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2016-11-23T16:48:09Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate expressions issue</title>
      <link>https://community.esri.com/t5/python-questions/concatenate-expressions-issue/m-p/406389#M32006</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As a side note, be aware that the field delimiters will change depending on the data source. In your case you probably work with an enterprise gdb since the fields do not have any double quotations (fgdb and shapefiles) or square brackets (personal geodatabases). In case you want to make it compatible regardless of the data source (assuming that the field names are not to long) you could consider using the:&amp;nbsp;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-functions/addfielddelimiters.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-functions/addfielddelimiters.htm"&gt;AddFieldDelimiters—Help | ArcGIS for Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The help contains examples&amp;nbsp;of how to implement it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Nov 2016 17:10:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/concatenate-expressions-issue/m-p/406389#M32006</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2016-11-23T17:10:24Z</dc:date>
    </item>
  </channel>
</rss>

