List - Error Select List Item

Hola, ¿como hago para que el select list item no seleccione un numero de la lista si no tiene mas datos para colocar?

Explicación: Tengo una base de datos, app inventor llama el column name y las pone en un label y cuando no tiene mas datos para colocar sale "Select list item: Attempt to get item number 3 of a list of length 2"

English:

Hello, how do I make the select list item not select a number from the list if it has no more data to place?

Explanation: I have a database, inventor app calls the column name and puts them in a label and when it has no more data to place it exits "Select list item: Attempt to get item number 3 of a list of length 2"

Show your blocks.

See also here.

Connect to Companion, make a right mouse click on this block → Do it and post the result.

grafik

"Select list item: Attempt to get item number 3 of a list of length 2"

and can anything be done to automatically disable it if it can't?

You can use the length of list block to check....the length of the list....before trying to select an item index higher than the length.

1 Like

grafik

1 Like

and since the number is taken from the length of the list, I cannot define the number because it is not a permanent number, since that data changes depending on the table (MySQL) that I choose

Which number?

in your example the 3 since when changing the alternative to a table that shows 7 labels it only shows 2

Explain exactly what the goal is. See again here:

Basically it consists of taking the names of the columns of a table from a database and placing them in a label (I have done this) but when changing the table it does not allow to put the column name due to the error "Select list item: Attempt to get item number 3 of a list of length 2".

So far I have 2 tables "usuarios - tabla_usuarios" and table_users if it allows it to be placed since it is 7 while the "users" table does not because it is less than 7 (7 is the maximum label I have)

i now show my app


To shorten it, post the aia or a test aia.
I'll take a look at it tomorrow then.

i can send it by dm?

1 Like

You can achieve it by using three ways. i.e by using either

  1. For each number from to by
  2. For each items in the list
  3. A clock component

I sent you an aia via PM.

Here are the major changes/blocks.
There is certainly a more elegant way of doing this. :wink:

2 Likes

By the way, is there anything private or in need of protection in your aia?
I do not think so.

So next time post the aia publicly so everyone can learn from it and more people who may have more time than me can help you.