How do I assign a number value on a list picker ( listpicker only has texts on it)?

How to assign a number value on a list picker? ( listpicker only has texts on it)

Thank you! Im new to MIT app inventor.

1 Like

When you're putting data from designer section you need to add values separated by (,) comma.

The same thing is from blocks section.
image

When you want to set values from list.
image

or,
image

Did you want the SelectionIndex?

Or maybe the list block that looks up the index of some value in a list?

I would like to assign a value(integer) based on each list on the list picker. this is what I have on my elementsofstring. There are 5 items on that string.

image

Thank you!

1 Like

I would like to apply a certain value to each element. How can I do it? Thank you very much for your help.

1 Like

I would like to apply a certain value to each element on List picker, probably a integer on each text. How can I do it?

Thank you very much for your help.

image

You could make two corresponding lists, or a list of pairs, or a dictionary, selecting the number value from the index of your text selection.

Thank you. Im new to MIT inventor. Can I get an example of the dictionary option?

Is this the correct blocks? Thank you.

Like this:

I cant find the for each key with value in dictionary. Im really confused right now. I just started yesterday.

I want to create an app that can calculate the calories of a person based on their inputs.

Here is my aia file for you to see. Im so glad you can help.

Health_Doctor.aia (2.7 MB)

It is in the Control section of the palette on the left.

I really cant see it. Can you check my aia file for you to see? Im really confused.

It is there

image

You will need to set your blocks toolkit to Default in project properties

These are the errors made. I want to put the value based on the user preference in the blocks that I circled. But the app inventor read the key not the number value.

Did you change your blocks toolkit to default, and find the block you need ?

Have you built your app using my blocks? (do not set listpicker elements elsewhere)

You can create a variable to put in your formula, and set the output from the listpicker to the variable to then run the calculation