Hi All,
Can anyone suggest a better way to batch add fields using the model builder? See attached image.
Thanks,
Solved! Go to Solution.
This shows that 4 additional field were created.
My first thought is to use Python and arcpy.AddField_management(). This assumes all the fields are the same type and length. If they are all different, it can still be done but the code would have to be changed a bit.
import arcpy
testtable = r"C:\temp\mygdb.gdb\Test"
newfields = [
"Test1",
"Test2",
"Test3",
"Test4",
"Test5"
]
for field in newfields:
arcpy.AddField_management(
testtable, ## in_table
field, ## field_name
"TEXT", ## field_type
)
print "{} added".format(field)