Select to view content in your preferred language

ArcGIS Pro 2.0 | How to design Fields in shapefile from Catalog Pane ?

2027
14
Jump to solution
01-26-2018 08:05 AM
VincentLaunstorfer
Frequent Contributor

Hi,

Just a simple question. From the Catalog Pane, if I right-click a shapefile -> Design -> Fields, I can view the fields but cannot edit them, such as making a field Nullable for example.

All the fields are greyed out!

Morever, I made these fields with the ModelBuilder Add Field with a variable set to IsNullable (as the option is not included in the Add Field right-click settings in ModelBuilder)

Finally, if I use Delete Fields (as below), these fields still show up in the Field design pane! As a result, the ModelBuilder crash because it considers these fields still existing...

 

I am puzzled and I suspect ArcGIS Pro do not refresh features classes after geoprocessing... If I restart, these fields do not show up and I can run the Model...

Any help appreciated

0 Kudos
14 Replies
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!

0 Kudos