Files
Introduction
It is possible to make use of the Schema (Any Format) reader to read the feature class names out of any database and then pass these names into a FeatureReader transformer to do the actual reading. This makes it possible to translate, for example, multiple Esri file geodatabases into another format, such as a shapefile, without knowing exactly which feature classes are in the database.
Step-by-step Instructions
1. Use the Schema (Any Format) reader to read folders of Geodatabases.
In a blank workspace, add a Schema (Any Format) reader to the canvas. For the dataset, click the arrow drop-down menu and select Select Multiple Folders/Files…. to get into the Advanced File Browser.
In the Advanced File Browser, click Add Folders… and then select the folder that contains all the geodatabases you want to read in. For this example, we will use the Data folder, which is located in the FMEData2018 folder. Then, under File/Filter, type *.gdb, which will select all files with the geodatabase file extension. Finally, enable Subfolders so that the file browser will look through all of the subfolders contained within the Data folder.
The Schema (Any Format) reader will read the list of feature classes in all the geodatabases in the folders and return the names of the feature classes in an attribute called "fme_feature_type_name".
2. Set up the FeatureReader
Add a FeatureReader transformer to the canvas, connect it to the Schema reader, and open up the parameters. In the FeatureReader parameters, set the Format to Esri Geodatabase (File Geodb Open API). For the Dataset, use the drop-down arrow to select the User Parameter SourceDataset_SCHEMA. This parameter was created by the Schema reader.
Next, for the Feature Types to Read, select the fme_feature_type_name attribute using the drop-down menu. This attribute is generated by the Schema reader.
Expand the Attribute and Geometry Handling section, and then expand the <Generic> Port section. For Attributes to Expose click on the ellipsis [...] and type in fme_feature_type, this will ensure that the fme_feature_type attribute is exposed when we connect our writer to the <Generic> port.
The remaining FeatureReader parameters can be left at their default values. Additionally, the FeatureReader returns the schema of each feature class, which can be accessed by connecting to the <Schema> port.
3. Dynamic Writing
Add an Esri Shapefile writer to the canvas and select your output location. For the Shapefile Definition, select Dynamic (Advanced).
Connect the writer to both the <Schema> and <Generic> output ports on the FeatureReader.
In the writer parameters, ensure that the Shapefile Name is set to fme_feature_type and that the Geometry is set to From Schema Definition. Finally, change the Schema Source to “Schema From Schema Feature”, uncheck any other schemas.
If reading Multiple Geodatabases with the same schema, ensure you are not sending any duplicate Feature Type names to the Feature Reader. Otherwise, FME will continue to read the feature type again, producing duplicates. Add a DuplicateFilter before the FeatureReader set to the Feature Type name.