Solved

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


Badge +1

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

icon

Best answer by nielsgerrits 3 May 2022, 12:35

View original

4 replies

Badge +1

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)

Userlevel 6
Badge +33

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.

Userlevel 6
Badge +33

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 

Badge +1

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