Skip to main content
Hello, 

 

 

Is there a way to check if a feature class exists in a file geodatabase . If not , throw an error . 

 

 

Is this possible ?
Hi,

 

 

The Schema (Any Format) reader can be used to read feature schemas from a dataset.

 

The reader creates features each of which contains a schema information including feature class name ("fme_feature_type_name" attribute). You can then determine if required feature class exists.

 

 

Takashi

@takashi I am pretty new to FME and am wondering how exactly I can check if a feature class exists? I was able to successfully load in the schema of the GDB and I see the attribute mentioned, but what transformer would help me best here? How can simply check if it exists?


@takashi I am pretty new to FME and am wondering how exactly I can check if a feature class exists? I was able to successfully load in the schema of the GDB and I see the attribute mentioned, but what transformer would help me best here? How can simply check if it exists?

You could use a Tester to test if fme_feature_type_name = <name of feature class you want to check for>

Another option is to use a Creator, AttributeManager, and PythonCaller, as shown in the following screenshot.

I have attached the same workspace for reference.

-Courtney


@courtney_m thank you, but can explain a little about what it is you put together? Why do I need to create a new fc?


@courtney_m thank you, but can explain a little about what it is you put together? Why do I need to create a new fc?

Sorry for the confusion - my Python function is called CreateFeatureClass, because I modified a function from one of my existing workspaces and forgot to change the name. The script is not actually creating a new feature class - It is just checking the GDB to see if the FC already exists, and if the FC does not exist, it prints "Error" in the log window.

Reply