Skip to main content
Solved

Iterate independently over files (and don't merge features)


Hello,

 

I use a Reader to list files inside a directory, connected to a FeatureReader to read the features.

 

Currently, all features of all files are merged. ie. if I have 100 files with 100 features each, the output of FeatureReader will be 10.000 features.

 

Is it possible to iterate incrementally over each file, ie. to execute a pipeline independently for each input file, so that the FeatureReader will be executed 100 times with 100 output features ?

 

Thanks!

Best answer by dustin

If you put the FeatureReader and everything downstream into a separate workspace, you could feed your 'files' reader into a WorkspaceRunner. For each file that enters the WorkspaceRunner, it would process that independently in the 2nd workspace.

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

3 replies

DanAtSafe
Safer
Forum|alt.badge.img+17
  • Safer
  • October 26, 2022

@0x974​ The FeatureReader is triggered when a feature enters it. In your case it is "executed" 100 times. After the FeatureReader you'll need to group by the fme_basename or another attribute value that is unique for each input file. Those 10,0000 features should come out of the FeatureReader in the same order that the 100 files went in.


dustin
Influencer
Forum|alt.badge.img+30
  • Influencer
  • Best Answer
  • October 26, 2022

If you put the FeatureReader and everything downstream into a separate workspace, you could feed your 'files' reader into a WorkspaceRunner. For each file that enters the WorkspaceRunner, it would process that independently in the 2nd workspace.


  • Author
  • October 31, 2022
dustin wrote:

If you put the FeatureReader and everything downstream into a separate workspace, you could feed your 'files' reader into a WorkspaceRunner. For each file that enters the WorkspaceRunner, it would process that independently in the 2nd workspace.

Yes, I did this, that worked like a charm. Thanks!


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