Skip to main content
Is there a way to create a list of unique vales from data, then prompt a user to select one of those values to use in the workbench ?
Hi,

 

 

Yes there are various ways to create published and private parameters, see the following for some info:

 

http://fmepedia.safe.com/articles/FAQ/Published-Parameters

 

 

http://fmepedia.safe.com/articles/Samples_and_Demos/Published-Parameter-Examples

 

 

http://fmepedia.safe.com/fmeSearch?q=parameter%20custom%20transformer
To elaborate on the subject with an example, you can create a csv file (or for that matter any format fme can read) containing (lets say) the bounding box coordinates of border features.

 

This csv can then be read, when creating a parameter (or using an exisitng e.i x min, y min x, max and y max) to provide the values for the user to select from.

 

 

This mght not be very elegant, so you can create two coloumns in the csv, say border feature name and the bbox coordinates, selecting choice with alias, will result in displaying the border name instead of the list of bbox coordinates.

 

 

This issue of the fme evangelist might provide some more info about using parameters.

 

 

Hope this helps.

 

 


thanks for the prompt reply ! I see from the examples this allows to prompt for a field name. What I need is an actually list of values from a field. To do this the prompt would need to come after part of the workbench has executed. The prompts from the examples happen up front correct ?
Hi,

 

 

That is usually the case, yes.

 

If you are interested in passing values on to a workbench, I would look into the master-slave combination using the workspacerunner.

 

That way the master ws extracts the values and passes them onto the slave that does the actual work.
Hi,

 

 

as far as I know, there is no simple way to present the user with a dynamic list of values. Yes, you can create published parameters, but in general the item values are always static, unless you go to some lengths to manipulate them.

 

 

One strategy could be to create a Python scripted private parameter that connects directly to your datasource (using Python modules rather than the FME readers) and that constructs a list of possible values. You could then reference this dynamic list inside a published parameter of type Choice (see "Concatenated parameters" here). But, as you can tell, this is a bit of an effort and a solution that goes a bit beyond standard FME usage.

 

 

The master-slave suggestion by Itay is a very interesting one, but I would be interested to hear how he imagines that implemented so that you'll be able to present the user a dynamic list of input values in a published parameter. Certainly, an elegant solution without any scripting would be very welcome by many FME users :-)

 

 

David
Hi,

 

 

I have might have been too enthusiastic about passing on parameters, since the slave ws would be 'buried' in the workspacerunner and will not be able to present the values to the user.

 

 


Although it doesn't directly answer your question, an extremely useful transformer to know about when performing tasks like this is the UniqueValueLogger as it will identify all unique values in a field and send them to the log window for review. If you 'edit' this custom transformer you'll see it works with Lists, so you may be able to borrow some of this process as the starting point for your task...
Just a thought, but could you - within a pythoncaller transfomer create and show a listbox (using tkinter perhaps)?

 

 

I'm not sure wether you'd be able to get the workbench to pause or the python to interact with the display when it's within the fme process, so it's a long shot - interesting if it worked however,

 

 

Then i'd probably use the slave/master combo...

 

 

maybe you could add it to a scripted parameter instead however? Doing much of the data access and manipulation though fme transformers makes more sense to me, keep the scripting to a minimum.

 

 

Nick

 


just had a quick go and tkinter didn't work for me, probably because it can't initalize proparly from within the fme process?  some one might no more...

 

 

anyway plan B?  use your master workbench to create a simple dynamic html form to run your slave..getting a bit complex though!

 

 

Nick
Such a dynamic (uber dynamic?) translation entirely in FME would need some additions to FME.

 

Basically in a master-slave combo, the translation should be stoppen (something like the inspection window, so i guess not too difiicult to add), the parameters/lists values should be presented to the user and the slave can continue with the selected values.

 

Maybe easier said than done....any comments safe ppl?

 

 

Cheers,

 

Itay
Hi,

 

 

if you want to use stuff like tkinter you might want to do it outside of the workspace, that seems cleaner to me anyway.

 

 

My suggestion would be to execute FME from a stand-alone script, passing the selected values into FME via a pure text published parameter, then splitting and processing it from there.

 

 

Btw, did you know that there is a GenericReader object in the 'fmeobjects' Python API? It make it seems like it should be possible to use the native FME reader library inside a scripted Python parameter, which is something I find very promising. I have never tried it myself, but I hope to get some time to experiment with it soon, for exactly the same reasons as your original question. 

 

 

David

Reply