Select to view content in your preferred language

Append Table to End of Table

2382
17
10-27-2017 06:54 AM
MitchHolley1
MVP Regular Contributor

Is there a geoprocessing tool that literally appends one table (or columns) to the end of another?  ESRI does something similar in their 'Symmetrical Difference' tool.  See below for an example. 

I know I could do this with a Python for loop and the 'Add Field' function, but that seems costly.  I was hoping there was a geoprocessing tool that could do it for me.  

Thanks for any help!

17 Replies
DanPatterson_Retired
MVP Emeritus

arcpy.da.ExtendTable if you have numpy arrays... not a solution immediately probably, but keep it in mind

TedKowal
Honored Contributor

My 2 cents,

It sounds like you want to JOIN two tables.  But the Key ingredient to make this successful is to have a common key between both tables; then you can see both tables side by side with the rows lined up.  With out a common key, this is not doable under standard type practice without very creative logic.

curtvprice
MVP Esteemed Contributor

One approach that would be pretty efficient would be use Create Table (using table 2 as a template) and run a Join Field of table 1 with table 2. This is still a bit slow (Join Field can be slow with many records) but would be less work on your part.

RichardFairhurst
MVP Honored Contributor

What possible purpose is served by this type of join?  If there is no relationship between the two tables (since you never match any of the records of Table A to Table B for any reason), why do you need this output?  If it is a multi-field relationship I have a tool for dong that kind of match.  It would help a lot to understand why you want this type of output before suggesting the best approach for accomplishing it, especially if in the end there actually is a relationship between the two tables that you are failing to tell us about.

MitchHolley1
MVP Regular Contributor

I've mentioned twice in this thread that I need a output table that is similar to the one created by the Symmetrical Difference tool. 

0 Kudos
JeffWard
Honored Contributor

Here is what I would do -

  • Join the two tables using a field of the same type - integer, text, float (it won't matter that none of the records join since your desired output is null field values for the right half of table A and null field values for the left half of table B) This step is so you have the fields from Table A tacked on to the right side of table B.
  • Export the joined table to a new table. This step makes all of the fields permanent in a new table.
  • Append Table B to the new table selecting "NO_TEST" in the Schema Type setting. Then map the fields to the corresponding fields in the new table. The Append tool is in Data Management - General toolbox.

This should get you what you are after if I understand your requirements correctly.

Jeff Ward
Summit County, Utah
TedKowal
Honored Contributor

Would not a simple cut and paste in an excel file do the same with less steps.  Paste table a, Paste table b just to the right of table a 

MeredithBliss
New Contributor

I have run into this issue too. Rather than have to loop through and add 20-30 fields, I was hoping to copy a table, truncate the data, and then simply add the empty fields to the right of the data in existing feature class. From there I can use a dict join to move my data over. Data is too large for the join field tool to be efficient. The need is to simplify processing and scripting time.

0 Kudos