Select to view content in your preferred language

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

2026
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
1 Solution

Accepted Solutions
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
14 Replies
DanPatterson_Retired
MVP Emeritus

I don't know about modelbuilder, but there are lots of ways to get to designing fields

0 Kudos
VincentLaunstorfer
Frequent Contributor

Hi,

Following my previous post, it looks like Nullable field are not possible on shapefile, which would explain the greyed out part in the Field Design pane and the IsNullable variable not applied in the ModelBuilder above...

If that's the case, how a newly calculated field would work is Null value are not allowed? In the same model, I receive the following error and I cannot complete the ModelBuilder!

How can I calculate this field?

0 Kudos
DanPatterson_Retired
MVP Emeritus

Shapefile fields are not nullable for sure so if at some stage you are using Add Field http://pro.arcgis.com/en/pro-app/tool-reference/data-management/add-field.htm

make sure you set it so that the field is not nullable

0 Kudos
VincentLaunstorfer
Frequent Contributor

Thanks Dan for your insight.

You are correct, I cannot add a Nullable field in a shapefile. The Calculate Field in my Model gives an error when it tries to calculate a Null field. This is illustrated here from the attribute table:

It is obvious. The column on the left cannot be Null and as a result, it cannot "calculate" the value coming from the right column.

That's ok, but how is it possible to skip these Null values from Calculate Field?

With ArcMap 10.5.1, I used to receive warnings for such cases but the processes could continue into my Model until it was finished...

0 Kudos
VincentLaunstorfer
Frequent Contributor

Unless I write a Python expression in the Code Block with an if statment to test if there is a Null value:

If Null value -> not calculate

Else -> Calculate

Tedious but it could work

0 Kudos
DanPatterson_Retired
MVP Emeritus

python parser for calculate

if not None:

   ... calculate value...

would be safer since 'null' is a slippery concept, but None will work

0 Kudos
VincentLaunstorfer
Frequent Contributor

I tried and tried again and I cannot figure out the proper syntax:

The Model joins a shapefile in which I would like to calculate the OPERATOR field (which cannot be Nullable) and a text tab delimited joined table. The Python function should be quite simple but it does not work! And the process in the Model do not even consider as correct and colored in green... Where is the error?

0 Kudos
DanPatterson_Retired
MVP Emeritus

if that is a python code block

if operator is None:

    return operator

if and is are not capitalized.

As for the field that you are passing to test( ) I presume it is a field in the destination table and not the table you are using to join to it.

Barring that.... Do the calculate field manually using Calculate Field and get the correct syntax in the Results window.  It will have the correct python syntax

VincentLaunstorfer
Frequent Contributor

Dan, your advice helped with the syntax, with capital letters and indentation. Now ArcGIS Pro seems to recognize it and highlight python keywords in blue, and the box in ModelBuilder turns yellow for the process:

But still when I run the tool, I get the error because the field in not nullable in the shapefile! It should not because the If statment from the Code Block is supposed to filter out Null values (None)

This is just a nightmare!

0 Kudos