Skip to main content
Solved

Loop through multiple choice user parameter


rclarkenz
Contributor
Forum|alt.badge.img+2

Hi I'm new to FME and have been unsuccessful in figuring this out.

My workspace originally had a choice user parameter where the user could choose a single string (eg. AA) which was then used to read GeoTIFFS that have that string in their filename.

Now I want to have multiple choice, and I have changed the user parameter to be a Choice (Multiple). So the parameter ends up looking something like this: AB EB TT

I'm trying to figure out how I can now have the workspace loop through and execute the transformers on each choice one at a time.

TIA

Best answer by erik_jan

There is multiple ways of doing this, but I would try:

Create an attribute from the parameter.

Use the AttributeSplitter (space delimited) to generate a list from the chosen values (AB and EB and TT).

The use the ListExploder to get features per value in the list.

Feed these features to the mentioned transformers that you need to execute.

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

7 replies

erik_jan
Contributor
Forum|alt.badge.img+18
  • Contributor
  • Best Answer
  • April 4, 2017

There is multiple ways of doing this, but I would try:

Create an attribute from the parameter.

Use the AttributeSplitter (space delimited) to generate a list from the chosen values (AB and EB and TT).

The use the ListExploder to get features per value in the list.

Feed these features to the mentioned transformers that you need to execute.


rclarkenz
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • April 4, 2017
erik_jan wrote:

There is multiple ways of doing this, but I would try:

Create an attribute from the parameter.

Use the AttributeSplitter (space delimited) to generate a list from the chosen values (AB and EB and TT).

The use the ListExploder to get features per value in the list.

Feed these features to the mentioned transformers that you need to execute.

Thanks @erik_jan! This worked perfectly.

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • April 6, 2017

this won't execute the input one at a time (looped) running the workspace for each choice separately. It's just feeding it 3 features, which is not the same.


damian6105
Participant
Forum|alt.badge.img
  • Participant
  • November 13, 2020

I have exactly the same issue. And @gio is correct, the recommended solution does not iterate though the list resulting from the ListExploder. Can anyone recommend a working solution for iterating through values provided by a multiple choice user parameter?

Regards, Damian


ebygomm
Influencer
Forum|alt.badge.img+39
  • Influencer
  • November 13, 2020
damian6105 wrote:

I have exactly the same issue. And @gio is correct, the recommended solution does not iterate though the list resulting from the ListExploder. Can anyone recommend a working solution for iterating through values provided by a multiple choice user parameter?

Regards, Damian

You are probably best raising this as a new question explaining what you are trying to achieve


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • November 13, 2020
damian6105 wrote:

I have exactly the same issue. And @gio is correct, the recommended solution does not iterate though the list resulting from the ListExploder. Can anyone recommend a working solution for iterating through values provided by a multiple choice user parameter?

Regards, Damian

Workspacerunner.

Feed the the result of the exploded list to a workspacrunner.

or

Feed it to a custom containing relevant processes (if possible and or desirable)

 addendum.. custom requires tsesting of counter inside custom. WHich makes workspacerunner an easier option

 

Use the count of the listexploder to guide the proces. ( _element_index)


damian6105
Participant
Forum|alt.badge.img
  • Participant
  • November 19, 2020
gio wrote:

Workspacerunner.

Feed the the result of the exploded list to a workspacrunner.

or

Feed it to a custom containing relevant processes (if possible and or desirable)

 addendum.. custom requires tsesting of counter inside custom. WHich makes workspacerunner an easier option

 

Use the count of the listexploder to guide the proces. ( _element_index)

Great, thank you @gio​ ​, worked a treat. I used the original suggestion by @erik_jan​ (AttributeSplitter, ListExploder), added the Workspacerunner, and then the rest of my FME script after that.

Regards, Damian


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