Lists and goal count

Hi guys,

I keep getting this error message

Select list item: Attempt to get item number 5 of a list of length 4: [" ", "0", "0", "0"]

This is my block code

I also tried with this block code

This is the Home Screen, when the user has logged there 4 goals, they get a percentage 100%, however atm when I log the 4 goals, 75% comes up and 3 out of 4 goals completed and 3 goals saved?

This is my php code:

Anyone know how I can fix this?

Thank you

Well, as you can see from your error message, you are attemptong to get a fifth element from a list that only has four elements.

It could be that in AI2 list indexes start at 1, whilst in other coding languages list/array indexes start at 0?

In your screenshot you do not select the fifth item, so it looks like the error occurs somewhere else in your blocks

You also can display the response content in a label for debugging


How can I display the response content in a label for debugging?

set Label1.Text to get response content

A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook App Inventor 2 Book: Create Your Own Android Apps ... the links are at the bottom of the Web page. The book 'teaches' users how to program with AI2 blocks.
There is a free programming course here Course In A Box and the aia files for the projects in the book are here: App Inventor 2 Book: Create Your Own Android Apps
How to do a lot of basic things with App Inventor are described here: How do you...? .

Also do the tutorials Tutorials for MIT App Inventor to learn the basics of App Inventor, then try something and follow the Top 5 Tips: How to learn App Inventor


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

The response content is coming back as Users name eg
Bill Adams, 0, 0, 0 ?

Try to understand what @Taifun say. You are error says, you are trying to pick 5th item of an 4 items array list. But there is no evidence in your block (using 5 in index place). In your screenshot the maxinum number used in index place is 4. So share us relevant blocks