Select to view content in your preferred language

ArcGIS Pro 3.0.2: How to replace the records of “null” value with zero with a tool in model builder?

939
5
Jump to solution
12-01-2023 02:34 AM
JamalNUMAN
Legendary Contributor

ArcGIS Pro 3.0.2: How to replace the records of “null” value with zero with a tool in model builder?

 

In the screenshot below, the “percent” field has records of “null” value. What could be the best way to replace these values with zero with a tool in model builder?

 

Clip_568.jpg

 

----------------------------------------
Jamal Numan
Geomolg Geoportal for Spatial Information
Ramallah, West Bank, Palestine
0 Kudos
1 Solution

Accepted Solutions
DanPatterson
MVP Esteemed Contributor

You already have a calculate field in your model.

Did the calculation incorporate checking for Null?  If it did, you could assign a 0 value.

for example conceptually   

if A is None, or B is None:

    return 0

else:

    return A/B * 100


... sort of retired...

View solution in original post

5 Replies
DuncanHornby
MVP Notable Contributor

I would feed that table into a select by attribute tool and select rows where Percent Is Null. The output of that tool is a table\featureclass with a selection, that simply feeds into a calculate field tool and you set it to zero.  Remember all geoprocessing tools honour selections first, if nothing is selected then the whole dataset is processed.

DanPatterson
MVP Esteemed Contributor

You already have a calculate field in your model.

Did the calculation incorporate checking for Null?  If it did, you could assign a 0 value.

for example conceptually   

if A is None, or B is None:

    return 0

else:

    return A/B * 100


... sort of retired...
JamalNUMAN
Legendary Contributor

I wanted to replace the records of “null” value with zero BUT to keep the same number of records (which is 253 records) of the attribute table. How this can be performed optimally?

 

Clip_569.jpg

----------------------------------------
Jamal Numan
Geomolg Geoportal for Spatial Information
Ramallah, West Bank, Palestine
0 Kudos
DanPatterson
MVP Esteemed Contributor

What is the expression that you used in "calculate field" ?


... sort of retired...
JamalNUMAN
Legendary Contributor

 

Clip_572.jpg

----------------------------------------
Jamal Numan
Geomolg Geoportal for Spatial Information
Ramallah, West Bank, Palestine