Skip to main content
Solved

FeatureReader - Schema GDB name Final Output

  • March 6, 2024
  • 2 replies
  • 128 views

galigis
Enthusiast
Forum|alt.badge.img+20

Hi All,

I have created a workspace that reads all GDBs included in a folder (and subfolders) and export a few attributes to an excel file but now need to bring the GDB name (path_filename) into the final output. I tried to expose the attribute to bring it along the workflow but seems isn’t part of the unexposed attributes.

I was expecting to see the GDB name as part of the Generic elements (within the unexposed attributes) but the GDB is only in the <Schema>,

How can I bring the GDB name as column in the final output (excel file in this case)?

<Generic> screenshot

<Schema> Screenshot

 

Best answer by nielsgerrits

You can get fme_basename or fme_dataset, but you have to dig in the FeatureReader’s settings to switch it on:

  • FeatureReader
    • Format = Esri Geodatabase (File Geodb)
    • Parameters…
      • Schema Attributes
        • Additional Attributes to Expose
          • fme_basename
          • fme_dataset
    • <Generic> Port
      • Attributes to Expose
        • fme_basename
        • fme_dataset

As an alternative, this is how I do it:

  • Creator
  • FeatureReader
    • Format = Directory and File Pathnames
    • Path Filter = *.gdb
    • Recurse Into Subfolders = Yes
  • Keeper
    • Attributes to Keep = path_windows
  • FeatureReader
    • Format = Esri Geodatabase (File Geodb)
    • Dataset = path_windows
    • Attribute and Geometry Handling
      • Accumulation Mode = Merge Initiator and Result

This merges path_windows to all features read by the second FeatureReader. If you only want the name, you can always use the FilenamePartExtractor to get it from path_windows, and you probably want to do this before the second FeatureReader.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

nielsgerrits
VIP
Forum|alt.badge.img+62
  • Best Answer
  • March 6, 2024

You can get fme_basename or fme_dataset, but you have to dig in the FeatureReader’s settings to switch it on:

  • FeatureReader
    • Format = Esri Geodatabase (File Geodb)
    • Parameters…
      • Schema Attributes
        • Additional Attributes to Expose
          • fme_basename
          • fme_dataset
    • <Generic> Port
      • Attributes to Expose
        • fme_basename
        • fme_dataset

As an alternative, this is how I do it:

  • Creator
  • FeatureReader
    • Format = Directory and File Pathnames
    • Path Filter = *.gdb
    • Recurse Into Subfolders = Yes
  • Keeper
    • Attributes to Keep = path_windows
  • FeatureReader
    • Format = Esri Geodatabase (File Geodb)
    • Dataset = path_windows
    • Attribute and Geometry Handling
      • Accumulation Mode = Merge Initiator and Result

This merges path_windows to all features read by the second FeatureReader. If you only want the name, you can always use the FilenamePartExtractor to get it from path_windows, and you probably want to do this before the second FeatureReader.


galigis
Enthusiast
Forum|alt.badge.img+20
  • Author
  • Enthusiast
  • March 6, 2024

Thanks @nielsgerrits - the ‘Accumulation Mode = Merge Initiator and Result’ did the trick :)