<?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: Find and Replace Null values in ModelBuilder in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/find-and-replace-null-values-in-modelbuilder/m-p/527976#M17593</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;One way I quickly thought of is to just convert the feature class to a shapefile.&amp;nbsp; Shapefile's do not support Null entries and automatically convert Null to zero.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Eric&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 21 May 2012 21:51:49 GMT</pubDate>
    <dc:creator>EricRice</dc:creator>
    <dc:date>2012-05-21T21:51:49Z</dc:date>
    <item>
      <title>Find and Replace Null values in ModelBuilder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/find-and-replace-null-values-in-modelbuilder/m-p/527975#M17592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm trying to create a model that will take selected feature classes, search their attributes, and remove any &amp;lt;Null&amp;gt; values in these tables.&amp;nbsp; Some of these fields will be an integar field type so I would need to replace these &amp;lt;Null's&amp;gt; with 0.&amp;nbsp; Do you have any ideas to go about this?&amp;nbsp; Thanks in advance!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 May 2012 18:26:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/find-and-replace-null-values-in-modelbuilder/m-p/527975#M17592</guid>
      <dc:creator>CraigPrisland</dc:creator>
      <dc:date>2012-05-21T18:26:59Z</dc:date>
    </item>
    <item>
      <title>Re: Find and Replace Null values in ModelBuilder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/find-and-replace-null-values-in-modelbuilder/m-p/527976#M17593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;One way I quickly thought of is to just convert the feature class to a shapefile.&amp;nbsp; Shapefile's do not support Null entries and automatically convert Null to zero.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Eric&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 May 2012 21:51:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/find-and-replace-null-values-in-modelbuilder/m-p/527976#M17593</guid>
      <dc:creator>EricRice</dc:creator>
      <dc:date>2012-05-21T21:51:49Z</dc:date>
    </item>
    <item>
      <title>Re: Find and Replace Null values in ModelBuilder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/find-and-replace-null-values-in-modelbuilder/m-p/527977#M17594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In ModelBuilder, try using Iterate Field Values iterator - you'll get it from the Insert menu &amp;gt; Iterators.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Make your data input to the Iterate Field Values as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]14519[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The iterator iterates through each value of a chosen field of the selected features. If there is no selection then it iterates all features. To get 0 for null values, be sure to set Null Value to 0 (last parameter in this dialog). &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]14520[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the above dialog, for the BEAT field of crime data, all &amp;lt;null&amp;gt;s will be replaced by 0 (in this case). You can replace null with any other value (such as -9999). Hope that helps. Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 May 2012 15:54:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/find-and-replace-null-values-in-modelbuilder/m-p/527977#M17594</guid>
      <dc:creator>NobbirAhmed</dc:creator>
      <dc:date>2012-05-22T15:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: Find and Replace Null values in ModelBuilder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/find-and-replace-null-values-in-modelbuilder/m-p/527978#M17595</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the responses.&amp;nbsp; Is there anyway to search all of the fields in the selected map layers and not just one field?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 May 2012 19:29:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/find-and-replace-null-values-in-modelbuilder/m-p/527978#M17595</guid>
      <dc:creator>CraigPrisland</dc:creator>
      <dc:date>2012-05-22T19:29:34Z</dc:date>
    </item>
    <item>
      <title>Re: Find and Replace Null values in ModelBuilder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/find-and-replace-null-values-in-modelbuilder/m-p/527979#M17596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can do it ModelBuilder but in a cumbersome way. You will need to embed two extra models and a script tool in a main model. Instead, use this script - simple and straightforward.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy import os&amp;nbsp; # replace data path with your OWN data. in_data = r"C:\data\f.gdb\parcels"&amp;nbsp; field_list = [] numeric_fields = ["Double", "Integer", "SmallInteger"]&amp;nbsp; fields = arcpy.ListFields(in_data) for field in fields: &amp;nbsp;&amp;nbsp;&amp;nbsp; if (field.type in numeric_fields): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; field_list.append(field.name)&amp;nbsp; # convert the list of fields to a semicolor delimited string fields = ";".join(field_list)&amp;nbsp;&amp;nbsp;&amp;nbsp; rows = arcpy.UpdateCursor(in_data, '', '', fields) count = len(field_list)&amp;nbsp; for row in rows: &amp;nbsp;&amp;nbsp;&amp;nbsp; for k in range(count): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if row.isNull(field_list&lt;K&gt;): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.setValue(field_list&lt;K&gt;, 0) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)&lt;/K&gt;&lt;/K&gt;&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Let me know if you have any trouble. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you want you can modify the script a little bit to use it in a script tool.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2012 16:30:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/find-and-replace-null-values-in-modelbuilder/m-p/527979#M17596</guid>
      <dc:creator>NobbirAhmed</dc:creator>
      <dc:date>2012-05-23T16:30:45Z</dc:date>
    </item>
    <item>
      <title>Re: Find and Replace Null values in ModelBuilder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/find-and-replace-null-values-in-modelbuilder/m-p/527980#M17597</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That worked great.&amp;nbsp; Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2012 13:56:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/find-and-replace-null-values-in-modelbuilder/m-p/527980#M17597</guid>
      <dc:creator>CraigPrisland</dc:creator>
      <dc:date>2012-05-25T13:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: Find and Replace Null values in ModelBuilder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/find-and-replace-null-values-in-modelbuilder/m-p/527981#M17598</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This thread seems to be the answer to my issue but I can't quite get it to work. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Basically, I am looking for a way to replace &amp;lt;Null&amp;gt; by -9999 in multiple fields at once, using ArcGIS 10.1. The Find and Replace function in the Attribute table doesnt seem to work for &amp;lt;Null&amp;gt; cells. I've never used the ModelBuilder option and wondered if either of you could explain the steps / code in more detail? In particular, could you highlight the sections I need to adapt so it works for my own data? (I tend to get confused with what's script and what's user-specific :/)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My file name 'data' and address is: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"C:\Users\Amanda K\Desktop\NN\data.gdb\data"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Field names include: sst, chl and sal.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help would be much appreciated. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Amanda&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Apr 2013 14:10:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/find-and-replace-null-values-in-modelbuilder/m-p/527981#M17598</guid>
      <dc:creator>AmandaKuepfer</dc:creator>
      <dc:date>2013-04-05T14:10:54Z</dc:date>
    </item>
    <item>
      <title>Re: Find and Replace Null values in ModelBuilder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/find-and-replace-null-values-in-modelbuilder/m-p/527982#M17599</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;You can do it ModelBuilder but in a cumbersome way. You will need to embed two extra models and a script tool in a main model. Instead, use this script - simple and straightforward.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
import os

# replace data path with your OWN data.
in_data = r"C:\data\f.gdb\parcels"

field_list = []
numeric_fields = ["Double", "Integer", "SmallInteger"]

fields = arcpy.ListFields(in_data)
for field in fields:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (field.type in numeric_fields):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; field_list.append(field.name)

# convert the list of fields to a semicolor delimited string
fields = ";".join(field_list)&amp;nbsp; 

rows = arcpy.UpdateCursor(in_data, '', '', fields)
count = len(field_list)

for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for k in range(count):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if row.isNull(field_list&lt;K&gt;):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.setValue(field_list&lt;K&gt;, 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)
&lt;/K&gt;&lt;/K&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Let me know if you have any trouble. &lt;BR /&gt;&lt;BR /&gt;If you want you can modify the script a little bit to use it in a script tool.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am also trying to incorporate "float" field types as well into this script.&amp;nbsp; I am adding "float" into this line:&lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt; numeric_fields = ["Double", "Integer", "SmallInteger", "Float"]&lt;/SPAN&gt;&lt;SPAN&gt;.&amp;nbsp; However, the float field does not update.&amp;nbsp; Any ideas?&amp;nbsp; Thank you in advance.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:00:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/find-and-replace-null-values-in-modelbuilder/m-p/527982#M17599</guid>
      <dc:creator>CraigPrisland</dc:creator>
      <dc:date>2021-12-11T23:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: Find and Replace Null values in ModelBuilder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/find-and-replace-null-values-in-modelbuilder/m-p/527983#M17600</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Consult this topic:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/#/Field/018z0000004n000000/"&gt;Field (arcpy)&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The field types in arcpy.Field object are mapped as follows - float type is mapped to Single. So, use 'Single' instead of 'Float'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Blob �??Blob&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Date �??Date&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Double �??Double&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Geometry �??Geometry&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Guid �??Guid&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Integer �??Integer (Long Integer)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;OID �??Object ID&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Raster �??Raster&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color:#006400;"&gt;&lt;STRONG&gt;Single �??Single (Float)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SmallInteger �??Small Integer (Short Integer)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;String �??String (Text)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Jun 2013 16:25:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/find-and-replace-null-values-in-modelbuilder/m-p/527983#M17600</guid>
      <dc:creator>NobbirAhmed</dc:creator>
      <dc:date>2013-06-27T16:25:49Z</dc:date>
    </item>
  </channel>
</rss>

