Skip to main content
Question

Python Start Up Script results used within User Parameter

  • September 17, 2024
  • 2 replies
  • 53 views

femo
Contributor
Forum|alt.badge.img+6

Hello,

i am facing the following task. csv-files that have different headers (different columns) are to be processed. In other words, file1 has a set of attributes, file2 has a different set of attributes, etc. In a Python start up script, the different columns are determined whenever the workbench is started.

 Now i would like to use these attributes within published parameters. The idea:

A published parameter “p_city” asks for the column which corresponds to “p_city” (name of the city). The user can select among the columns that have previously been determined by the start up script.

How can i pass the determined columns from the start up script to a fme parameter? Or do you have a better idea?

Best wishes 

2 replies

dustin
Influencer
Forum|alt.badge.img+31
  • Influencer
  • September 17, 2024

I think a better approach may be the Scripted parameter type. As far as I know, the value from the Startup Python script can not be passed to a user parameter. Values of the parameters are established at runtime.

 


femo
Contributor
Forum|alt.badge.img+6
  • Author
  • Contributor
  • September 18, 2024

@dustin, thanks a lot for your reply. I have progressed a little bit. Using a pythoncaller I can now determine the header attributes as a semicolon separated string. By means of an attributesplitter I can now create a list containing the individual items. My idea now is to use these list to “somehow” create a user parameter “choice” out of it.

However, this posts 

User choice parameter using read data as choices | Community (safe.com)

says that it is not possible to create a user parameter at run-time. At least I understand it like this. Takashis workaround is smart, but a bit too smart for me :-)

I will try to find a solution using a lookup table.

Thanks again for your support anyway!