Skip to main content
Solved

Loop through multiple choice user parameter

  • April 4, 2017
  • 7 replies
  • 119 views

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.

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

erik_jan
Contributor
Forum|alt.badge.img+22
  • Contributor
  • 2179 replies
  • 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
  • 13 replies
  • 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.

Thanks @erik_jan! This worked perfectly.

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • 2252 replies
  • 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
  • 8 replies
  • 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+44
  • Influencer
  • 3422 replies
  • 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

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
  • 2252 replies
  • 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

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
  • 8 replies
  • November 19, 2020

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