Filtering option sets for use in a dropdown

Hi Everyone,

This is probably a very basic question, but I’ve been struggling like crazy to figure it out. In short, when a user creates a new database entry, I’m trying to hide/remove items from an option set that have already been used. I’ve included a bit more info below:

I’ve created an option set called Exchanges with the names of crypto exchanges. When a user adds a new exchange to their profile, they need to select the exchange from a dropdown (which is populated using the Display attribute of the Exchanges option set), and add some other info like user ID, API key and so forth.

By way of an example, let’s say there are 5 exchanges in the option set and the first time a user adds an exchange, they add Kraken to their profile. Subsequently, should they wish to add another exchange, Kraken should not appear in the dropdown list.

I have a data type called Exchanges which stores the info about the exchange that is relevant to the user (Exchange name, API keys, user ID, date created etc). So I need to search the Exchange name text field of the Exchanges data type and ensure that all Exchange names already saved to the database are not included in the dropdown list when adding a new exchange.

I’ve tried using the filtering and minus options based off a search of the database, but I can’t seem to get it right.

Any help would be greatly appreciated.

Thanks,
Dylan

Hi there, @dylanmartens… here is one way to do it that I just tested. Add a field to your User data type called exchanges, and set that field’s type to a be a list of Exchanges (that is, link it to your option set and make it a list). Then, when a user adds an exchange to their profile, make changes to the current user and add the selected exchange to their list. With that setup in place, filtering the dropdown is as simple as this…

Again, that’s just one way to do it, but it works well, and you won’t need to search through your entire Exchanges data type just to render the appropriate options in the dropdown.

Hope this helps.

Best…
Mike

Legend - thanks so much! Works like a bomb!

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.