Runtime Error - Daily Planner App

PlannerSep29_copy (2).aia (4.6 KB)


My project is a daily planner app, and I'm having trouble with the When List.AfterPicking function
When I select something on my list I get a runtime error saying the values "error" and "0" are coming from
The string "error" is a string I put in to flag it, but I am unaware as to where the "0" is coming from.
I need to delete a certain event (the one the user selects from the list) from the list - in a to do list fashion, but I can only do this by selecting something from the list.

I am working on the yellow function at the very bottom of the picture - a .aia is also attached for your convenience.

5e17fc186d794d68c773d8eb0a8ad002011a4210_2_350x499

See the Do It article in

to see what TinyDB is returning, and use the "is a list" block to verify that TinyDB returns a list.

1 Like

Screenshot 2021-10-05 143106
This is the "is a list" block, but it needs a second argument to be put into the other side.

Feed it the output of the TinyDB GetValue for tag 'Events".

What is the other side? The left side of the block? You could display the result for example in a label... or use an if statement... loads if possibilities...

A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook http://www.appinventor.org/book2 ... 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 http://www.appinventor.org/content/CourseInABox/Intro and the aia files for the projects in the book are here: http://www.appinventor.org/bookFiles
How to do a lot of basic things with App Inventor are described here: http://www.appinventor.org/content/howDoYou/eventHandling .

Also do the tutorials http://appinventor.mit.edu.ezproxy.canberra.edu.au/explore/ai2/tutorials.html to learn the basics of App Inventor, then try something and follow the Top 5 Tips: How to learn App Inventor

Taifun


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

2 Likes

How can you remove a list item from a string? It should result in an error.

1 Like

Perhaps it would be of mutual benefit to better explain the program. This is a daily planner app, in which there is a text box, timepicker, and datepicker to create an event. The data is compiled into a string (the AddEvent procedure), which is added to a tinyDB, which in turn goes into a list. The contents of this list are shown with the ListView element. I have created the when List AfterPicking function to delete an event on the list, this event is the event that has been clicked.
That is the purpose of this function, but what it currently does is displays a runtime error, a brief message stating that the values "Events" and "0" are not acceptable arguments. I have replaced "Events" with "error" as to flag it for you to easily see. In the runtime error now, if you run the program on an emulator, the "Events" is replaced by "error", proving that that is the first unacceptable argument. There is also a variable that sets itself to whatever the selection index is on the listView.
I assume the way to fix this error is to replace these two statements with ones that the program can accept. My questions are:
What do I replace the string that currently says "error" with?
Where does this "0" value from the runtime error come from?
What can I do to fix this "0" value once it has been identified.

Your original blocks had several errors:

  • You confused tags with events at one point.
  • You did not check to see if you had a list returned from the tag Events, nor correct for that.

Here are corrected blocks, draggable:

I also had to move your Delete buttons atop the ListView to make them visible in my emulator.


PlannerSep29_copy2.aia (5.6 KB)

Thank you.
I did not consider using if-then statements to check if the inputs were acceptable, this has been hugely helpful

Your code does seem to have an error in the fundamental creation of an event, one that I can't begin to comprehend. This is the new runtime error that I receive when I write an event title and click create event.image