Question

Output multiple GDB's in a single workbench?

  • 30 January 2023
  • 3 replies
  • 2 views

Badge

I have multiple shapefiles in a folder with subfolders. Example Folder "01" has 10 shapefiles, Folder "02" has 15 shapefiles, etc. I was able to create a gdb and load all the features into the gdb but the whole thing is too large. Is it possible to have FME create a new gdb for each subfolder name? What I would want is a new gdb named 01, for the data that was in 01. Another new gdb named 02 for the data that was in 02, etc.

thanks!


3 replies

Userlevel 3
Badge +26

You will want to fanout out the GDB writer based on the folder name, but first you will need to extract the information from the source features, which will be stored in the format attribute fme_dataset (after you expose it on the reader).imageNext, use an AttributeSplitter with \ as the delimiter. This will create a list of each element in the source directory path for each feature. Since it's not guaranteed we know the exact number of folders in the full path, we need to count how many elements are in the directory path. We can use a ListElementCounter for that.

imageThen on the GDB writer parameters, enable the Fanout parameter and copy this expression in. This should name your gdb after your containing folder.

@Value(_list{@Evaluate(@Value(_element_count)-2)}).gdb

imageHope that helps.

Userlevel 3
Badge +26

You will want to fanout out the GDB writer based on the folder name, but first you will need to extract the information from the source features, which will be stored in the format attribute fme_dataset (after you expose it on the reader).imageNext, use an AttributeSplitter with \ as the delimiter. This will create a list of each element in the source directory path for each feature. Since it's not guaranteed we know the exact number of folders in the full path, we need to count how many elements are in the directory path. We can use a ListElementCounter for that.

imageThen on the GDB writer parameters, enable the Fanout parameter and copy this expression in. This should name your gdb after your containing folder.

@Value(_list{@Evaluate(@Value(_element_count)-2)}).gdb

imageHope that helps.

@inframan​ Not sure if you saw my original post, but I edited the post with a more direct solution.

Badge

I figured that would be part of it, just figured out the rest. FilenamePartExtractor to get the folder name and use it with a Fanout on the writer.

Reply