Question

Can we add a Custom User Parameter that allows for selection from a list populated via an API?

  • 31 January 2022
  • 4 replies
  • 2 views

Badge

By way of an example, the Google Sheet reader parameters allow for the Specific sheet to be referenced after a lookup of the Workbook's URL given an authenticated web connection.

 

Screenshot 2022-01-31 at 16.02.58 

I'd like to populate a similar list based on an authenticated web connection, also following an API call based on another parameter field – and if that is possible to cascade multiples of these.

 

This doesn't appear to be available in the Manage User Parameters dialog set.


4 replies

Userlevel 5
Badge +29

There are not really any easy ways to achieve this... I'd suggest adding something to Ideas - https://community.safe.com/s/idea/Idea/00B4Q00000ABiEt

 

There are some pretty hacky ways you could achieve this with Python. Ultimately it will interrupt your workbench and generate an FME popup which has been dynamically generated from the API calls...

Badge

Thanks, A popup will be fine while I'm still working on the functionality.

 

I have been looking at the SDK, (so far only Python and only on Mac) but I haven't seen much yet regarding custom UI inputs.

Userlevel 5
Badge +29

Thanks, A popup will be fine while I'm still working on the functionality.

 

I have been looking at the SDK, (so far only Python and only on Mac) but I haven't seen much yet regarding custom UI inputs.

Have a look through here - https://community.safe.com/s/question/0D54Q000080hC9cSAE/select-different-feature-type-each-time-workspace-runs

@Takashi Iijima​

Userlevel 4
Badge +25

This is something that I covered in a previous Question-of-the-Week. See here: https://community.safe.com/s/question/0D54Q000080hfA1SAI/question-of-the-week-dynamic-but-hacky-updates-to-published-parameter-choices

 

In short, it's not possible using the standard tools. My old answer said you couldn't use Python because it won't present a list of values, but I suspect Hamish is correct that a popup window would work.

 

Let's say you have a workspace to process data. What I did was create a second workspace that reads the list of values (I used text or Excel, but an API would work). It then opens up the first workspace as a text file, replaces the published parameter prompts, and writes it back.

 

Check out that link for the full details.

 

Anyway, it works, but there are a couple of obvious issues.

 

1) It's not really recommended to edit a workspace that way! But this is simple enough that it's not a big deal.

2) You have to run that first workspace before the second one can prompt the user. I don't know if that fits into your workflow or not. On Server, you could get the user to go to an app that automatically runs the second workspace and passes the user to a second app which opens the first workspace with its parameters!

 

Anyway, I hope this is of use.

Reply