Skip to main content
Solved

how to get the schema of two files with the same name in two different subdirectories ?


arthur_bazin
Contributor
Forum|alt.badge.img+13

Hi,

 

I'm creating a workbench to make some audit on GIS files.

First my workbench list all files that are into a directory (including subdirectories).

Then, I filter theses files to keep only the one I want to audit, for exemple every shapefiles.

Finaly I get the schema of every shapefile with the <schema> output of a FeatureReader.

 

It works really great but if I have two files with the same name in two different subdirectories my problem comes : only 1 schema is kept.

That's how FME works, it unions feature types with the same name.

 

But in my case, I need to analyse the schema of every layer even if they have the same name. This is an audit so these file can have different schema even if they have the same name.

 

I want to have an automatic workbench and not having to create one FeatureReader for each directory.

 

Is there anyone with an idea on how to get the schema of two files with the same name in two different subdirectories ?

 

Thank you

Best answer by nielsgerrits

You can simply work around this by creating a Custom transformer with only a FeatureReader in it. Then you can configure it to do a "Group By" and you will get one schema feature for each input.

View original
Did this help you find an answer to your question?

4 replies

arthur_bazin
Contributor
Forum|alt.badge.img+13
  • Author
  • Contributor
  • May 3, 2022

The only idea that I have is :

Reading every feature

Sampling the first feature of each file (FeatureReader havn't the possibility to read only a certain number of feature per feature type)

Retreiving the schema of this feature

 

It's really time and ressource consuming + the schema is the one that FME create for the feature, not the original schema (some little difference between fme datatype and the original one)


nielsgerrits
VIP
Forum|alt.badge.img+54

You can simply work around this by creating a Custom transformer with only a FeatureReader in it. Then you can configure it to do a "Group By" and you will get one schema feature for each input.


nielsgerrits
VIP
Forum|alt.badge.img+54
nielsgerrits wrote:

You can simply work around this by creating a Custom transformer with only a FeatureReader in it. Then you can configure it to do a "Group By" and you will get one schema feature for each input.

Attached a workspace template demonstrating this.

2022-05-03_12h37_56 


arthur_bazin
Contributor
Forum|alt.badge.img+13
  • Author
  • Contributor
  • May 3, 2022
nielsgerrits wrote:

You can simply work around this by creating a Custom transformer with only a FeatureReader in it. Then you can configure it to do a "Group By" and you will get one schema feature for each input.

Oh my god why I didn't think of this. So simple, yet so effective !

Amazing how you can learn from other FME users after years of using it.

 

Thank you very much !!

Have a nice day !


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