I need help to finish this proyect

contador_de_macronutrientes.aia (17.5 KB)
when i press the button "calcular" i have an error whit list

If you are asking for help, I recommend you to make it as easy for others to be able to help you ...
You probably will get more feedback then...

which means in your case post a screenshot of your relevant blocks...

To download the aia file, upload it to App Inventor, open it, do some bug hunting for you, etc... this takes time, and most people will not do that...
Thank you.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

1 Like

Your Designer:

Your blocks:

I regret to inform you that you have not yet learned how to work with lists, or with tables.

This could have been much easier and with fewer blocks.

You also need the concept of table lookup.

Your ingrdients' nutritional values should be rows in a nutrition table:

Your initializations will never work like that. Arroz_blanco starts out as a list (false,false,false,false).

Your nutrition table should be a csv table loaded from a Media folder (//) file.
Here's a starter:
Ingredient,protein,carbohydrates,grasa,calories
arroz_blanco,3,30,0.3,130
arroz_integral,2.6,23,1,111
...

You should be using a ListView to show what ingredients you have chosen so far, and their quantities.
Behind that Listview you should have a recipe table with two columns (ingredient, quantity).
You only need one List Picker to select the next ingredient to add to the recipe, not three of them.


Once you have a selection of what ingredient to add, use list filter blocks to get the nutritional value of that ingredient.