Skip to main content

Idea

When using Python, return FME_MacroValues["ParameterName"] as an object instead of a string, so we can access both the value and the definition of the Published/Private Parameter.

Why would this be helpful?

  • It allows us to see if the parameter was Private, Public and/or Optional.
  • We can see what the Default Value is. It can be handy to have this value in case the Python code needs to resort to another solution if the value that the user entered produces the wrong result.
  • We can get a nice descriptive name of the parameter (from the Prompt field), so we can create nice log messages are another kind of user feedback to tell that a parameter value is wrong for instance.
  • We could read the Configuration for a Choice parameter for instance, in the same order in which the choices are specified in the Definition dialog. Then, we could check if the parameter value is equal to a configuration list item by index, so that we no longer need to hardcode all the choice values in the PythonCaller if we want to run a different function for each choice for instance. This reduces the risk of breaking the code if we change one of the choice values in the Parameter Definition Dialog. It would only still break (or give unexpected results) if we would change the order of the choices, but that I can live with.
  • If we have an object anyway, there might also be an additional property inside that tells us what native Python type the parameter value can be converted to. Or better yet, simply return the parameter value as a Python type...

Hi, I am running into the following: my workspace needs three user (published) parameters of type choice with alias, the last one being dependent on the secondĀ one. In particular, displayname of parameter two would be value of parameter three and vice versa. Instead of forcing the user to make the same choice twice, it would be my desire to be able to create a third scripted parameter that automatically picks the right value from parameter 2's configuration of displayname/value pairs. So, an upvote for this idea!