DanPatterson_Retired
MVP Emeritus

I know this is from PRO, but it is the same in 'Map  see the code block

assuming your field is called that, field.isNullable

http://pro.arcgis.com/en/pro-app/arcpy/classes/field.htm

Test the field... 

isNullable
(Read and Write)

Indicates if the field can contain null values.

0 Kudos
VincentLaunstorfer
Frequent Contributor

Just one last question, I cannot Calculate Field containing the silly ~ sign, such as in ALASKA~C. How can I improve my code to deal with these ~ signs?

0 Kudos
DanPatterson_Retired
MVP Emeritus

don't know...

also, in your accepted answer, also add a check to see if the field is numeric since it will have to return 0 rather than ''... hence the suggested  'isNullable' check, because if it isn't nullable, then it already has the shapefile equivalent for None (aka '' for text and 0 for numbers)

0 Kudos
VincentLaunstorfer
Frequent Contributor

Thanks Dan. You're correct, I should check if the field is Numeric or Text in order to assign either 0 or ''. This would make the code more robust. Will investigate this soon...

Otherwise, Calculate Field with special character such as ~ did finally work with the code shown below (don't know waht happened yesterday!)

0 Kudos
VincentLaunstorfer
Frequent Contributor

Found the solution!

When there was a Null value in the joined table, the conditional statment could not "leave" a Null value in the shapefile. Instead, I inserted an else statment to return an empty value!

View solution in original post

0 Kudos