Right I see…
There are probably a few ways to do this…
The first, and obvious way, is to do as you suggested: simply do a search for Users, and display each item’s Skill, with Unique Elements added to only display each Skill option once.
That’s the simple way - but as you’ll be searching your entire User database every time you’re displaying the dropdown at can be pretty slow once you have a large number of users.
We had a very similar requirement on one of our apps, and originally did just that. Whilst it was fine to begin with, we found it became too slow to be much use pretty quickly as the number of database items being searched increased.
Alternatively you can apply a filter to the option set based on how many Users have each skill - but again that requires a search of your entire User database, so may become too slow.
So, a much better way to handle this is to have a simple, and lightweight, method to define which options are displayed, and be able to change that programmatically via workflow actions in your app.
If we were able to modify Options and their attributes via workflows (the way we can with database objects) this would be simple - just have an attribute on the option set that determines whether or not an option is displayed (originally set to no), and anytime a User adds an option that isn’t displayed, jut change its display field to yes. Simple.
However that’s not possible with Option Sets currently in Bubble - but there’s a simple way to do almost the same thing, and it works very well for us and is super fast.
So here’s what I’d recommended: (we use this method to handle 'Category’s in our app - we have a large option set of categories, but we only want to display categories on pages that have products, users, or blog posts associated with them, so we use this method and it works great).
Create a new datatype that will be used to define which Options (Skills) will appear in your dropdown (in your case call it something like ‘Skills To Display’).
All you really need on this datatype is a single field, that is a list of Skills (the option set), although if you have different places in your app where you want to display different lists of skills for different things you can include more fields as needed.
Then just add a single database entry, with no skills set in the skills field (although you can pre-define which skills to show here if you already know which ones you want to display).
Then run a workflow anytime a User signs up with a new skill to add that skill to this item’s list of skills.
Then, for the datasource of your option set, just do a search for this ‘Skills To Display’ database entry (it’s super quick as there will only ever be a single entry), and use the list of Skills as the datasource.
That way you have full dynamic control over which options are displayed or not, can add new ones dynamically via workflow actions when users add new skills, and it’s very lightweight so loads very quickly.
Don’t forget you’ll need to have a database object in both your dev and live databases.