I have multiple FGBs (10) with many feature classes (about 30). Most of the feature classes are joined to a table which is specific to each feature class (i.e. 30 feature classes to 30 tables). I would like to make the joined fields permanent so that I can merge the datasets as required.
The manual process to do this would involve r-click > 'export data' for each feature class in the TOC but this is not feasible given the number of datasets.
Based on esri help pages and other SE threads I started with this code to copy features:
# Copy features from a FGD to FGD import arcpy import os # Set environment settings arcpy.env.workspace = "C:/GIS/Groundwater_Inventory/Data/GW_Theme_Recharge/Study_Areas/Recharge_Summary_areas.gdb" arcpy.env.qualifiedFieldNames = False # Set local variables out_workspace = "C:/GIS/Workspace/Inventory_data/Recharge_simple.gdb" # generate a list of features in the workspace fc_list = arcpy.ListFeatureClasses() # Execute CopyFeatures for each input feature for feature in fc_list: out_featureclass = os.path.join(out_workspace, os.path.splitext(feature)) arcpy.CopyFeatures_management(feature, out_featureclass)
Images of tables and feature classes attached. I suspect I need to recreate the join in this script but cannot find any threads which describe this process.
I am using ArcGIS, with entry level python/programming experience.
EDIT: I resolved this issue by copying the required data in the tables into a single csv file using a VBA script based on this help page: https://www.thespreadsheetguru.com/the-code-vault/2014/4/23/loop-through-all-excel-files-in-a-given-folder
I then merged all feature classes and from there I could perform a simple attribute join to the new table.