Hello!
I try to make a join of the fields using the iterator for multiple FeaturesClasses that have the same fields. So, I should differentiate them by their FeaturesClasses names. like this : NameFeaturesClasses_NamefildJoin , for example BATI_CAout_QCooling.
How can I include featureClasses names with join field names using ModelBuilder ?
thank you for your collaboration.
Solved! Go to Solution.
related how to add the name of FeatureClasses to the names... - Esri Community
Add Join and Join field are your two conventional options.
A third alternative is to build arrays with the desired data using TableToNumPyArray.
Assemble the arrays in NumPy and use ExtendTable once with the resultant or use it multiple times to permanently join to a featureclass table.
You can change the field names in numpy
a = TableToNumPyArray(in_fc, "*", skip_nulls=True)
flds = a.dtype.names
new_flds = [f"Bati_{i}" for i in flds]
new_flds
['Bati_OBJECTID',
'Bati_Shape',
'Bati_ids',
'Bati_CENTROID_X',
'Bati_CENTROID_Y',
'Bati_INSIDE_X',
'Bati_INSIDE_Y',
'Bati_PART_COUNT',
'Bati_PNT_COUNT',
'Bati_Sort_',
'Bati_Shape_Length',
'Bati_Shape_Area']
# ---
# -- magic time
from arcpy.da import ExtendTable
a.dtype.names = new_flds
sub_arr = a[['Bati_OBJECTID', 'Bati_PART_COUNT']]
ExtendTable(in_fc, "OBJECTID", sub_arr, 'Bati_OBJECTID')
Magic done
of course you would want a preselected list of fields to produce/slice fields from the main array to make sub_arr.
related how to add the name of FeatureClasses to the names... - Esri Community
Add Join and Join field are your two conventional options.
A third alternative is to build arrays with the desired data using TableToNumPyArray.
Assemble the arrays in NumPy and use ExtendTable once with the resultant or use it multiple times to permanently join to a featureclass table.
You can change the field names in numpy
a = TableToNumPyArray(in_fc, "*", skip_nulls=True)
flds = a.dtype.names
new_flds = [f"Bati_{i}" for i in flds]
new_flds
['Bati_OBJECTID',
'Bati_Shape',
'Bati_ids',
'Bati_CENTROID_X',
'Bati_CENTROID_Y',
'Bati_INSIDE_X',
'Bati_INSIDE_Y',
'Bati_PART_COUNT',
'Bati_PNT_COUNT',
'Bati_Sort_',
'Bati_Shape_Length',
'Bati_Shape_Area']
# ---
# -- magic time
from arcpy.da import ExtendTable
a.dtype.names = new_flds
sub_arr = a[['Bati_OBJECTID', 'Bati_PART_COUNT']]
ExtendTable(in_fc, "OBJECTID", sub_arr, 'Bati_OBJECTID')
Magic done
of course you would want a preselected list of fields to produce/slice fields from the main array to make sub_arr.
Thank you for your help, I will try this approach.
closed?