<?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: Testing for Null Values in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/testing-for-null-values/m-p/294523#M22803</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN style="font-style:italic;"&gt;"where attribute x is a valid string value (not null, not an empty space, not a placeholder value, etc.) and attribute y is not a valid string value (null, an empty space, etc.)."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think this is how I would write it (you shouldn't need all the square barackets and /s):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"(X IS NOT NULL OR X not in (""," ")) AND (Y IS NULL OR Y in ("", " "))"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Note this is already in string format ready to plop into the MakeFeatureLayer tool.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 Jun 2011 16:00:00 GMT</pubDate>
    <dc:creator>ChrisSnyder</dc:creator>
    <dc:date>2011-06-21T16:00:00Z</dc:date>
    <item>
      <title>Testing for Null Values</title>
      <link>https://community.esri.com/t5/python-questions/testing-for-null-values/m-p/294522#M22802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;All,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a script that is building feature layers based on a SQL expression evaluating an attribute combination. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.MakeFeatureLayer_management(&amp;lt;feature class&amp;gt;, &amp;lt;new layer name&amp;gt;, &amp;lt;whereclause&amp;gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to find conditions where attribute x is a valid string value (not null, not an empty space, not a placeholder value, etc.) and attribute y is not a valid string value (null, an empty space, etc.).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I can build out an expression in ArcMap and it returns exactly the records I am looking for using:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"[Attribute X] Is Not Null AND [Attribute X] &amp;lt;&amp;gt; "" AND [Attribute X] &amp;lt;&amp;gt; " " AND [Attribute Y] Is Null OR [Attribute Y] =&amp;nbsp; "" OR [Attribute Y] = " ""&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, when I build that expression to run from the Python script, It will still pull in the records that I am looking for but also some records with null Attribute X values:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"[Attribute X] Is Not Null AND [Attribute X] &amp;lt;&amp;gt; \"\" AND [Attribute X] &amp;lt;&amp;gt; \" \" AND [Attribute Y] Is Null OR [Attribute Y] =&amp;nbsp; \"\" OR [Attribute Y] = \" \""&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It seems like the expression is exactly the same but I am getting different results. Is there a better way to test for null values in an attribute table? Did I screw up the SQL somehow?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jun 2011 15:40:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/testing-for-null-values/m-p/294522#M22802</guid>
      <dc:creator>BenYoungs</dc:creator>
      <dc:date>2011-06-21T15:40:29Z</dc:date>
    </item>
    <item>
      <title>Re: Testing for Null Values</title>
      <link>https://community.esri.com/t5/python-questions/testing-for-null-values/m-p/294523#M22803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN style="font-style:italic;"&gt;"where attribute x is a valid string value (not null, not an empty space, not a placeholder value, etc.) and attribute y is not a valid string value (null, an empty space, etc.)."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think this is how I would write it (you shouldn't need all the square barackets and /s):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"(X IS NOT NULL OR X not in (""," ")) AND (Y IS NULL OR Y in ("", " "))"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Note this is already in string format ready to plop into the MakeFeatureLayer tool.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jun 2011 16:00:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/testing-for-null-values/m-p/294523#M22803</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2011-06-21T16:00:00Z</dc:date>
    </item>
  </channel>
</rss>

