Hi All,
Can anyone suggest a better way to batch add fields using the model builder? See attached image.
Thanks,
You can start with the Add Field tool in a Model, right-click the tool and Make Variable - From Parameter. Field Name would be the first one you need. Open it's Properties and set to List of Values. Open the Parameter and you can do all kinds of interesting things like Insert values from a table...
Add any other Variables from Parameters as needed to accommodate different field design across fields.
Yes. Within the model builder.
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)
I think he wants it within the model builder, not doing it manually.
Hi Randy,
Have you tried to batch add fields by right clicking the Add Field Tool in the Data Management Tools>Fields Toolset?
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.