Select to view content in your preferred language

Append tool returning <Null> fields - table to layer append

1283
4
Jump to solution
04-03-2023 07:30 PM
dwold
by
Occasional Contributor III

I am trying to update a layer in Pro with a table the has updated information. I am trying to use the Append tool. When I run the tool, the field remain <Null>. Should I be using the Append tool or something different?

dwold_0-1680575401419.png

@DanPatterson 

@DavidPike 

@Robert_LeClair 

@JohannesLindner 

 

0 Kudos
1 Solution

Accepted Solutions
DanPatterson
MVP Esteemed Contributor

You can't append a csv file to a featureclass.  You can use Join field

Join Field (Data Management)—ArcGIS Pro | Documentation


... sort of retired...

View solution in original post

4 Replies
DanPatterson
MVP Esteemed Contributor

You can't append a csv file to a featureclass.  You can use Join field

Join Field (Data Management)—ArcGIS Pro | Documentation


... sort of retired...
dwold
by
Occasional Contributor III

@DanPatterson Hi Dan - Thanks for you help with this. I ran the Join Field tool. It created a new field in my layer but the value is still <Null>. I've attached a screenshot. Do you see anything that I am doing wrong that it is always returning a <Null> value?

dwold_0-1680577071661.png

 

0 Kudos
JohannesLindner
MVP Frequent Contributor

 I am trying to use the Append tool

The Append tool is not suited for this task. It takes all features from one table and copies them to the second table. That is not what you want to do here.

 

As @DanPatterson suggested, Join Field could work. You can't get it to work because you need to join on a common field. That is "Name" in your case, but you're trying to join on "Mgmt".

 

Another way to do this is with a little python script (untested):

# parameters
input_table = "HOA_Boundaries_ExportFeature"
update_table = HOA_Export_Test.csv"
join_field = "Name"
update_fields = ["Mgmt"]

# read the update table into a dict
fields = [join_field] + update_fields
updates = {row[0]: row for row in arcpy.da.SearchCursor(update_table, fields)}

# loop over the input table with an UpdateCursor
with arcpy.da.UpdateCursor(input_table, fields) as cursor:
    for row in cursor:
        # copy the updated values
        try:
            cursor.updateRow(updates[row[0])
        except KeyError:
            # no update found for this join_field, ignore
            pass

 


Have a great day!
Johannes
Robert_LeClair
Esri Notable Contributor

Dan and Johann are all correct in their responses.  One thing that stood out to me in the common field between your two tables - it does not appear unique enough to me.  For Joins in ArcGIS Pro, you have to consider cardinality, 1-1, M-1 and only in ArcGIS Pro 1-M. You can read more about it here.