List picker value

How to include value on list picker like selectbox behaviour on HTML?

as illustration below

Mango Banana Tomato

Because I need to save key_id value on list picker selected text.

Welcome to the community. Please be more specific cause I do not understand what you want to do. Also in order to get help see how to …

Screen Shot 2020-10-26 at 8.05.16 AM

this is illustration that i mean. I need to get “002” value if i choose “Banana”.

1 Like

Now i understand
just make a list fruits = (mango banana tomato)
When option selected
Set value to index in list thing = option and list = fruits

1 Like

@Sumit1334 this is a good method.

I want to add some info.
If you want to use something like selectbox in HTML, you can use the Spinner component.
Or as your first post said, you can use LIst Picker.

Use set element (the green block) to set the list.
If you are using List picker:

  • Use the After Picking event and get the selection index (the light green one)

If you are using Spinner:

  • Use the After Selecting event and get the selection index (the light green one too)

The selection index indicate the index of your selection (start from 1)
As you said, the value is also a number so you don’t need to do anything else.

4 Likes

I think I tried this method, running well if i choose fruit without search before. but I found mismatch value_id from option value when i use search feature of fruits.

Maybe This:

Create your list with PrimaryKey-FruitName
95-Apple
56-Banana
87-Orange

After the user selects, separate the string in the hyphen “-” ( red block Split Text at ) and take the first item that will be your primary key

1 Like

Try using dictionary too if you want.

make dictionary {"apple":"001", "orange":"002","banana":"003"...}
Then use key in dictionary to get list of items.

After picking, use get value with the selection to number.

1 Like

I hope to hide 3 left character for it solution. :slight_smile:

1 Like

I tried your solution, and This is my block,

I failed split “kode” and “nama_wil” to listpicker although using “get value at keypath” of dictionaries. What is wrong…?

Show you full blocks please. I couldn’t help with that :sweat: