How to use List of Text as option in a dropdown

Hello everyone !

I’ve got a simple question, how to use a List of Texts as options in a dropdown ?

USER => Type of hair (List of Texts) :

  • Blond
  • Ginger
  • Black

I tried every split-by: and regex but nothing seems to work, I always have only one option in my dropdown : “Blond, Ginger, Black”

Thank you very much.

Why not just create an option set of these options and use that option set as data source to the dropdown?

2 Likes

Firstly, I agree with @maheshkasindi - I’d recommend not using texts here - option sets are much better suited for this, and give you way more possibilities and functionality, whilst at the same time making everything much simpler.

Having said that, if you do want to use texts, it should be as simple as setting the dropdown’s type of choices to text, and the source to the User’s list of Types of hair.

Is that what you’ve done already?

If it is, then presumably your Type of Hair field on the User is not set as a list (although you said in your post that it is, so I’m guessing you haven’t set the dropdown data source correctly).

But, I’d definitely suggest switching to use an option set for this instead.

1 Like

@maxime.brunet
Can you share screenshots from you app? I’ve previously implemented this (for a dropdown) in my app.

For example Text_1 (stored in the DB) = black, blue, yellow, red

Dropdown setting:

  • Choices style = Dynamic choices
  • Types of choices = text
  • Choices source = Text_1:split by(,)
1 Like

Yeah I think I am gonna do this, it’s way more simple.
It was for a more simple management system, in the future I prefer to manage this in the database than into the design system for a better visibility.

1 Like

It’s actually for video games. I use the user and hair for more simplicity.
But you choose a game, then you choose a map based on the game.
So if a map is added, I can add it in my app simply.

HERE THE SOLUTION

I created a new data types Maps.

In this data type, I created two fields =>

  • Name of the map
  • Game (Refer to the data types Games)

And in my dropdown here what I did :

I hope this will help someone <3

Thank you for the community help !

1 Like

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