I transferred a list from Screen2 to Screen1 using TinyDB. But when I try to upload the list to a list view and delete it in Screen1, I keep encountering errors. What should I do?"
Hello,
you can show the error you get and your relevant blocks (from both screens).
Sometimes errors pop up, and sometimes they don't. I was working on a task to display a to-do list called "Quest" on the main screen and ensure it remains the same when navigating back to the "Quest" screen. However, I encountered a strange error.
and this is error
I also want to know why, when I just wanted to delete one item, the entire list disappeared.
(Canned Reply: ABG- Export & Upload .aia)
Export your .aia file and upload it here.
.
The file is too large to upload. I would appreciate it if you could fix this issue.
Let's start with Screen1, and your Clock.
Your Clock is active, but you don't have a Clock Timer event in that Screen.
What is the purpose of keeping that clock active and able to run out of view?
That part is designed to reset the daily tasks. Even if the tasks I wrote in the quest window are completed and disappear from the main window, they are moved back to the main window the next day. The clock is there to continuously compare the previous and current dates at specific times and trigger an alert if the dates change. If you look at screen 1, you will find coding that stores the date as the previous date.
Proceeding into the main screen, I see you are opening other screens without closing the current screen.
In AI2, you must close screens as often as you open new screens.
I didn't know that. Thank you for letting me know.
The Clock can't do any such work, because it lacks a Clock Timer event to hold that logic.
It is also important to shut down timers before switching screens.
See the posts about how to switch screens.
Loading a non-list TinyDB default into a ListView Elements list will reult in an error.
The default should be an empty list.
I also added the clock logic.
Be aware that I live on the unexplored dark side of the Earth, unable to read your variable and component names.
So I will speak generally.
I am guessing this logic is some kind of last run date checking. Unless you are checking for people who run this app continually, crossing midnight, there would be no need to run and rerun this logic so frequently.
The screen initialize event should be all that is needed.
Thank you for your comment. I'll turn it to the initialization event
I see that in your latest code you are assigning an Elements list from a global variable, whose provenance I can't trace.
There is a danger in keeping data both in TinyDB and in global variables, where you lose track of which one has the truth. That can be avoided by reloading the variable from TinyDB immediately before updating it, then storing it back into TinyDB immediately. It's even better to use a local variable for this, to avoid all doubt. (In science fiction, you don't want your clones to live long.)
It's bed time on the dark side of the Earth.
I leave this thread for others to continue, hopefully people who can read your language.
Thank you so much for helping me. I hope you sleep well and have a good day