Error loading list data

I still benefit from your wisdom.
I created a list and that can be saved and loaded.
I inserted a control that loads the saved data every time I open the screen.
The problem is that the first time I open that screen it doesn't find any saved data, and it gives an error.
How can I insert a condition that loads data only if it finds saved data?

How are you saving your data? tinydb ?
Do you have a tinydb component with the same namespace in your other screen ?
Are you loading the data from there ?

Show your relevant blocks (only) for each screen

Yes, I use TinyDB
No, in each screen I use a different tinydb, tinydb1, tinydb2 etc...
Thanks, now I'll do a screenshot with the most relevant data.

Should be like this:



You can rename the tinydb component whatever you want in any screen, but the namespace must be the same in all screens to be able to access the same data.

the problem is that when the screen opens I ask it to load the saved data. But if I don't have any data saved it creates an error.

In the data loading screen:

assumes data is saved as a list

assumes data saved as a string

in fact, if I ignore the error and save the data, the error no longer appears.
I should insert a condition that loads the data only if it finds a save in TinyDB.


Worse yet, even if you used an empty list as a default, you are trying to select items without regard for the length of the list.

If you want to show a list without restrictions on its length, fill a ListView Elements from the list.

I thank you but I don't understand. I discovered app inventor 2 days ago and I still have to study a lot...


1 Like

Vi ringrazio, ho risolto così:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.