Question

How to add field to [GEODATABASE_FILE]


Badge

I can add a new field in the [GEODATABASE_FILE] writer under "User Attributes" and as long as I delete the feature class before writing the field shows up. But is there a way to do this without deleting and just adding a new field? Seems pretty easy but????


2 replies

Badge

Use AttributeCreator to make the new column/field then click on "Automatic" in Attribute Definition. That will update the schema of your table to include the new column. It essentially includes all of the columns in your data stream in the table.

Userlevel 4
Badge +13

Hi @mikesando . We usually recommend using your ArcGIS client to first add the required fields to an existing feature class and then writing with FME. However, you could use a PythonCaller before the writer to call in Esri's arcpy module and take advantage of the arcpy.AddField_management geoprocessing tool. You would need to make sure that your python interpreter in FME is set to use the interpreter installed by ArcGIS (https://knowledge.safe.com/content/kbentry/814/choosing-a-different-python-interpreter-installati.html).

A simple example of what might appear in the PythonCaller might look something like the following:

# Import Esri's arcpy module

 

import arcpy

 

 

def processFeature(feature):

 

# The location of the destination geodatabase and feature class you want to add a filed to.

 

feat_class = 'C:\\Temp\\MyGDB.gdb\\MyFeatureClass'

 

 

# Use arcpy Add Field geoprocessing tool to add a new Text field called "new_field" to the

 

# destination feature class.

 

arcpy.AddField_management(feat_class, "new_field", "TEXT")

Reply