1

I would like to create a user parameter that can be completed based on the inputs of a previous parameter. I'm wondering if this is possible because the dataset is unknown until I use a user parameter to determine what is read into the workspace - this means that it is not possible to use a WHERE clause in the FeatureReader, because there are no existing attributes available for it to pull from. I have tried looking through the different user parameter options, but can't see anything that would work - essentially as a tester - to filter the data that is read in with the first parameter. I am using FME 2020.

1 Answer 1

2

The best way to do this is to use a scripted parameter. FME supports both Python and TCL. I don't know TCL, so here's a very simple setup using a python scripted parameter (FME 2020.1, but this has been supported for years).

I have created two parameters. The first one is a choice parameter called "COLOUR" with three values, RED, GREEN, and BLUE. The second parameter is a python scripted parameter called "NUM" which will look at the COLOUR parameter, and depending on the value, return a number.

Here are the settings for the COLOUR Parameter: enter image description here

and the NUM parameter:

enter image description here

The python code I used is:

import fme

if fme.macroValues['COLOUR'] == 'RED':
    return 1
elif fme.macroValues['COLOUR'] == 'BLUE':
    return 2
else:
    return 3

Of course, this is a very simple example, and you can make this as complex as you need it to be.

There are a couple of examples of the use of these parameters on Python Scripted Parameters in FME.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.