How to populate a dropdown list and keep in memory the id of the user's selection?

Hello, I would like on my application to:

  • retrieve a list of workshops from my backend
  • populate a dropdown list with these workshops to allow the user to make a selection
  • retrieve the id of the selected workshop to then send a request to retrieve all workstations linked to this workshop

Here’s how I went about it.
First, I created a connector that allows me to retrieve all my workshops. This connector works well:
https://i.ibb.co/MpGJ6RG/connector.png

Next, upon arriving at my step, I launch a function that retrieves these workshops and stores them in a variable called “workshops.” I also execute a data manipulation that stores all the names of my workshops in a variable called “workshopName.”
https://i.ibb.co/wwhStG6/function.png

Next, I create a variable associated with my input to store the name of the selected workshop.

So far, this is where I’m at, and what I’ve shown thus far works. However, I’m having difficulty understanding how to retrieve the identifier of the workshop just by having its name. I’ve tried using expressions to retrieve the ID or using arrays, but I haven’t succeeded. I’m sure there’s a very simple way to achieve what I want, but I can’t seem to figure it out.

Thanks,
Matthias

Hello Mattias,

i believe the last part of this KB can help you : how-to-format-http-connector-outputs
You may need to store the output as Text list and use the method array_index_of()

KR,
Kevin

1 Like

Another way to achieve your goal would be to create a Tulip table with your Ids and workstations. Since you have already your connector, you can create an automation to update data in this table on a regular basis.
Tulip tables are easier to use than the Array/object list and you get the record history for free.
Your user can select his workstation with the “interactive table” widget then.

KR,
Kevin

1 Like