Skip to main content
Solved

How to perform a 'for each' loop in FME?

  • December 24, 2020
  • 4 replies
  • 2500 views

Dear all,

 

I use FME to perform a complex comparison analysis between two large datasets. I am looking for a way to analyze various subpopulations in succession, in order to reduce memory usage and increase performance. I have defined the desired subpopulations in a Reader file, so they can feed the SQLExecutor transformers to obtain the subsets. After performing the analysis on the first subset (i.e. 'Apple') and writing the results to a report file, the next subset (i.e. 'Banana') should be analyzed and so on.

 

fme 

How can I implement such a 'for each loop' within FME?

 

Thanks in advance.

 

Remy

Best answer by ebygomm

I'd personally use a parent workspace with a workspace runner to run the workspace for each line in your file, you should be able to use send Source_1 and Source_2 as parameters in the child workspace

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.

4 replies

hkingsbury
Celebrity
Forum|alt.badge.img+63
  • Celebrity
  • 1625 replies
  • December 24, 2020

ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3427 replies
  • Best Answer
  • December 29, 2020

I'd personally use a parent workspace with a workspace runner to run the workspace for each line in your file, you should be able to use send Source_1 and Source_2 as parameters in the child workspace


Forum|alt.badge.img+2
  • 194 replies
  • December 29, 2020

Workspace runner or a batch file will be your best bet.

 

If you are running something in a specific order and one at a time the runner works well.

 

If you running a comparison between the first two, comparing the result of that run to the next, etc. A batch file with a series of calls/start would let you spawn all the instances at once as independent processes. You can run up to 8 processes at a time.

 


  • Author
  • 3 replies
  • December 31, 2020

I'd personally use a parent workspace with a workspace runner to run the workspace for each line in your file, you should be able to use send Source_1 and Source_2 as parameters in the child workspace

Exactly what I was looking for!

 

Firstly, I added two Published User Parameters to the initial (child) workspace:

01 

After which I changed both SQLExecutors to SQLCreators that use the published parameters as SQL Statement.02At last, I created a parent workspace that affects the published parameters.

03 

Thanks a lot!