Skip to main content
Question

Output multiple GDB's in a single workbench?


inframan
Contributor
Forum|alt.badge.img

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

dustin
Influencer
Forum|alt.badge.img+30
  • Influencer
  • January 30, 2023

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.


dustin
Influencer
Forum|alt.badge.img+30
  • Influencer
  • January 31, 2023
dustin wrote:

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.


inframan
Contributor
Forum|alt.badge.img
  • Author
  • Contributor
  • January 31, 2023

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings