Skip to main content
Best Answer

Iterate parameter values for multiple transformers

  • August 15, 2019
  • 7 replies
  • 84 views

Hi,

I'm relatively new to FME but am interested in running a workbench that loops/iterates parameter values (Neighbour Finder distance, Bufferer distance, and a number value in a tester) multiple times.

E.g. I want to generate outputs with a buffer distance of 5000, 10000, 15000, neighbour counts of 4,5,6 etc.

What is the best way to set a workbench running, that will generate multiple different outputs, based on iterating through parameter values, naming outputs accordingly?

 

I wish to end up with multiple outputs in a format similar to

 

output_$BufferDistance_$NeighbourDistance_$NumberValue

Best answer by erik_jan

I would store the different values for the parameters in a file (Excel, CSV or similar).

Then use a reader to read the combination line by line.

Use the values in a WorkSpaceRunner transformer to run a workspace that uses the single combination and create the output.

Each line in the file would trigger the workspace to run with a different combination, creating the output as requested.

The name of the output file would use the published parameters like this:

output_$(BufferDistance)_$(NeighbourDistance)_$(NumberValue)

Hope this helps.

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.

7 replies

redgeographics
Celebrity
Forum|alt.badge.img+62

For looping you should take a look at custom transformers, that in combination with a fanout on the output filenames could do the trick. The FME Desktop Advanced course covers that. It's not a very easy thing to master though.

Somewhat easier perhaps is to set up one workspace that does the Neighbor finding, buffering and testing, create published parameters for the relevant values and then create a second workspace that runs the first one through a WorkspaceRunner. Feed that second workspace with an Excel file containing the values you want to put in the parameters.

 


erik_jan
Contributor
Forum|alt.badge.img+26
  • Contributor
  • Best Answer
  • August 15, 2019

I would store the different values for the parameters in a file (Excel, CSV or similar).

Then use a reader to read the combination line by line.

Use the values in a WorkSpaceRunner transformer to run a workspace that uses the single combination and create the output.

Each line in the file would trigger the workspace to run with a different combination, creating the output as requested.

The name of the output file would use the published parameters like this:

output_$(BufferDistance)_$(NeighbourDistance)_$(NumberValue)

Hope this helps.


ebygomm
Influencer
Forum|alt.badge.img+46
  • Influencer
  • August 15, 2019

In addition to the workspace runner suggestion, consider whether you need to 'loop' at all. Often you can just clone your inputs

Example: take multiple parameters, split to a list, explode the list to create multiple features each with an attribute containing individual parameter, buffer, write to different output files names according to the individual parameter

multiple_parameters.fmw


  • Author
  • August 16, 2019

I would store the different values for the parameters in a file (Excel, CSV or similar).

Then use a reader to read the combination line by line.

Use the values in a WorkSpaceRunner transformer to run a workspace that uses the single combination and create the output.

Each line in the file would trigger the workspace to run with a different combination, creating the output as requested.

The name of the output file would use the published parameters like this:

output_$(BufferDistance)_$(NeighbourDistance)_$(NumberValue)

Hope this helps.

Many thanks - this seems clearest for me to follow. Will update if it is any harder than it sounds!


  • Author
  • August 16, 2019

For looping you should take a look at custom transformers, that in combination with a fanout on the output filenames could do the trick. The FME Desktop Advanced course covers that. It's not a very easy thing to master though.

Somewhat easier perhaps is to set up one workspace that does the Neighbor finding, buffering and testing, create published parameters for the relevant values and then create a second workspace that runs the first one through a WorkspaceRunner. Feed that second workspace with an Excel file containing the values you want to put in the parameters.

 

Thanks, will investigate the custom transformers as long term they will be useful to master I suspect. Immediate priority is getting this job done so will go with the easier solution proposed


  • Author
  • August 27, 2019

In addition to the workspace runner suggestion, consider whether you need to 'loop' at all. Often you can just clone your inputs

Example: take multiple parameters, split to a list, explode the list to create multiple features each with an attribute containing individual parameter, buffer, write to different output files names according to the individual parameter

multiple_parameters.fmw

Thanks for this - at the time I must admit I didn't quite follow, but after some more familiarity with the software I think this is actually a good answer answer. I like the way it doesn't rely on an external list. Am I right to think that for multiple parameters you would essentially be chaining together attribute splitters and list exploders?


ebygomm
Influencer
Forum|alt.badge.img+46
  • Influencer
  • August 27, 2019

Thanks for this - at the time I must admit I didn't quite follow, but after some more familiarity with the software I think this is actually a good answer answer. I like the way it doesn't rely on an external list. Am I right to think that for multiple parameters you would essentially be chaining together attribute splitters and list exploders?

That would be one way to do it, there are various other possibilities if you want to generate all permutations of parameter combinations