Hey @DariusM, I think I have a solution that could work for you in the short term, but it’s a fairly complicated workaround. Hopefully, we can use these learnings to get the appropriate feature requests prioritized!
Here’s a recording of what I’m doing, with each step laid out separately to show the return.
As shown, there are four key steps needed to perform this.
- Pull the order list using a Tulip API (limit is set to 100 rows)
- Convert to a string with a common delimiter
- Utilize a SQL server to help eliminate the duplicates (does not need to store to a table)
- Convert the return SQL array to be suitable for a dropdown.
Now these steps don’t all have to be visible to the user, but I wanted to show what each one was doing.
The first button just runs a Tulip API connector function to grab some set of orders, which can be filtered as needed. This endpoint would obviously be specific to your own instance, tables, and column information.
The second button is simple, we just run a trigger for Array > Join to String, where we join our API return by a static delimiter (I used the pipe symbol “|”).
With our list of orders now joined as a single string, we can execute the third button which is the most complex. I’m not a SQL expert, so I’ve tried to add some comments to the logic to make as clear as possible, but there may be better solutions here. Ultimately, we want to take a string like WO-0001|WO-0002|WO-0001 and return WO-0001|WO-0002.
The SQL query essentially takes in the joined string, separates it to an array, and uses the unnest function to map this to a set of rows. From that subquery, we can then select distinct values before sending back as an array of unique orders. It’s worth mentioning that I’m using the Connectors Demo connector here, which is a PostgreSQL database.
Once we have the return, we just need to run our last button, which just uses the MAP_TO_TEXT_LIST expression to format this in a way that is compatible with the single select drop down. You just pass in the array and your key, in this case the name of your output, and it should store to a variable that can be linked to the single select!
I know this is a lot of info, please let me know if you have any questions and if this is helpful! Hopefully this can help unblock you in the short term while we work on better native support.
Thanks!
Grant