Error Select list item: Attempt to get item number


When I test my app i have an error "Select list item: Attempt to get item number 3 of a list of length 2:" but I don't see where there is this lenght.

I join the project FourColumnsTinydb.aia (10.8 KB)
It's a test project by aa community user modified by myself.

I added label and other button but I don't see where I forget a thing.

Can you help me ?

What are you trying to achieve ? I looked at your code and I can not understand. For axample you add a list that contains text, numbers, dates in global list and then you want to sum what ?

Thanks for your answer.

The idea is to stock data entered in the form and the Fourth column is numbers only and it's this column that I search to sum all the entries.

From here:

What you haven't done is made a sublist from your main list of all the 4th items, you then perform the sum on that sublist.

You originally asked for a solution (in your other topic) and now you have moved on to something quite different, trying to apply the solution from the other topic which may not be appropriate.

Explain in more detail what you are trying to achieve, draw pictures if needed, then perhaps someone here can provide you with a working solution.

Hope this will be understandable enough but here is a model

Not really :wink:

What is the data you are saving and why are you saving it ? - just explain what you are doing....

What is the difference between case 1 and case 2 ?
What type of data is entered in "Column 3" (give examples) ?
What type of data is entered in "Column 4" ( I understand this will be a number/integer )?

In your blocks, you are saving the value of a label to your list as well, what data is this, where is it shown ?

Why do you need to add up everything in "Column 4" ? What will you do with this value ?

Can you confirm that your four listviews are just for the display of information held in the tinydb (and for selection to allow for a record to be deleted) ?

What else will happen with this data. What parts of the app have you not yet told us about ?

Why do you need another screen ? This can all be handled on one screen....

As I previously asked, explain in more detail......

The checkbox 1 and 2 are two choices and just their labels are in the second column.
The column 3 is just text without restriction.
The column 4 is, effectly, just numbers and this is why we can't add everything in a one column.
The tinydb is for save data when the user return to the screen and for save the sum of numbers from column 4.
Like explained, the idea is to duplicate this screen and list all total entries in an indepedant screen like summary.

Why ? you already have the tinydb outputted to a set of listviews.... you could hide some parts of the existing screen to just show this....

You could use a switch component to select between case 1 and 2.
You probably need to display the date once selected (this helps to confirm it has been done, or you could display the current date if that is what is needed to reduce user input)

It would really help to understand what you are doing, this would make it much easier to provide a solution.

What are the texts in column 3 ? What are the numbers in Column 4 ? Are they repeatable items - could their selections also be in lists for the user to pick from ?

I don't have problems with the forms, in aia file, you can see they are built but I don't find how list them in columns, like a csv, save them in tinydb and do the sum of the column 4 values.

The summary screen is here to list all sums in a one screen like statistic page.

Try this:


FourColsTDB.aia (9.5 KB)




Thanks I see if I understand all of that but it's very cool your answers for my project.

When I test in companion, I have a message from a previous test : Select list item: Attempt to get item number 3 of a list of length 2: ["test", "1209"]

Do you know why, there is a cache ?

You need to empty your tinydb from the companion. Drag out the ClearTag block and set it to columnList, right click and Do It.

Thanks It's good and your switch idea is a good alternative to my checkbox choice.

It stay me my wish to call the sum in a summary screen.

How can I do to sum only the column 2 only when the case 1 is selected?

I test this but it's not good

I did ask......

You can use a procedure like this, just set the case you want.

Sorry, I have forgotten this point.

All works but the sum only need to take the column 2 numbers when the switch is on case 1.

I know my test "label6 textecolor = red" isn't good and I test "If switch1 .on" but it's not good too