ArcGIS Pro 2.1 - How to calculate Null values in a date field in shapefile?

7923
3
Jump to solution
05-17-2018 05:34 AM
VincentLaunstorfer
Occasional Contributor III

Hi,

In a model, after joining a shapefile to a text file, I am trying to calculate a newly created Date format field in the shapefile. But, whenever I have an empty date in the text file, the if else statment catches it and tries to fill a Null value in the Date field. But it crashes and not not work!

I tried:

return ''

return 'None'

return 'Null'

return '0'

But none worked! Any guess for the proper syntax? Thanks

1 Solution

Accepted Solutions
VincentLaunstorfer
Occasional Contributor III

Fount it! The statment is:

return None

with no single quotes!

View solution in original post

3 Replies
DanPatterson_Retired
MVP Emeritus

you have a code block but no field calculator expression

Addendum  Shapefiles don't support None, you will have to check for the empty string "" or ''

0 Kudos
VincentLaunstorfer
Occasional Contributor III

Tried "" or '' but still no luck! Tested it on shapefile and FGDB feature class as well.

As for the field calculator expression, it looks empty but actually it is not. It always does not show for no reason.

The problem comes from the None or Null format in the date field because if I set any date instead, it does work. Also, it works in former ArcToolbox. Is it related to Python 3 ? There must be a solution...

0 Kudos
VincentLaunstorfer
Occasional Contributor III

Fount it! The statment is:

return None

with no single quotes!