The Tutorial
I am adding this post under Video Tutorials since the discussion stems from a video tutorial I made on how to create a simple to do / task management app. Here is the original video:
Explanation
Someone tried replicating the app and wanted to enhance it by storing the tasks in a stored / local variable. However, this code was not working.
An Incorrect Solution
Your 1st instinct may be to set the variable to an empty list whenever the screen starts. This does not work because the app ends up clearing out the list every time you close and reopen the app. This defeats the purpose of the stored variable.
The Correct Solution
Rather, a better approach is to only set the variable to an empty list IF the list has not yet been defined. This makes the stored variable a list variable IF and ONLY IF the list is not yet defined. Thus it will not clear out any items previously stored in the list.
This is really nice; you guys should update the chat tutorial to be a bit more list this; the current tutorial saves the text onto a single string variable so itās confusing as to how it could actually be used in a real-life scenarioā¦
also, please fix the WebAPI component (at least on iOS) it simply doesnāt send any headers or body
(or maybe Iām doing something wrong and a tutorial using it would helpā¦?)
Hi Darren,
The piece of code worked perfectly!!
Thanks for helping out.
I got the question here if I could put a checkbox on a listā¦
So you could choose whether you want to check a task or delete itā¦
Another challangeš
@Dinto has also mentioned wanting a chat app to me before, but I think the list viewer needs some more property features before we could make one.
I think at a minimum, I would want to be able to left or right align different elements in the list viewer, and also add styling like coloring. Currently these features are not available.
@Dinto Glad to hear it. I also do not know of a checkbox feature to make complete.
With the current features available, I would suggest having a āTo Doā list and a āCompleted Listā. And when you click on an item in the To Do List, you could choose to delete or move to the Completed List.
in one of my list, the Notitie one, if I want to delete an item, it deletes the item I click on, it deles another one. I canāt find the error, it think itās a bugā¦
I am Testing the todo-list with two phone.
When I added an item to a list on one phone, it came up on the other phone. I donāt want to share the todo-list.
Some one who downloads the app have the possibility to make his or her own list.
Iām now storing the variables in the app ( at first seen in your tutorial in the cloud) How can I get this right?
Regards, Dinto
Hi Darren,
Itās been a few dayās ago, busy:sweat_smile:
Still having problems with the issue above;
I have two list, list one: Notitie and list two: Boodschappen.
When I add items to both list, and delete an item on one list, it deletes the item on that list but when I delete another item from the other list, it doesnāt delete the item I touch but the one under that itemā¦
Iāve delete the screens and start over again because thought it could also be a bug in one of the listviewers, didnāt help.
Iāve also change te code a bit, with local storage instead of the use of stored variable.
Could you give it a try?
I wil send you the project link
I believe this is a bug in the Thunkable code. The issue is with list indices, so anytime you are using a list, you may run into this error. See the issue on github here:
This check is currently working for me, so try this approach out:
I Tried you code, and it did work, for 2 days:
I read that it is a bugā¦
The notitie screen is working, but de Boodschappen screen is now deleting two items at a time.
Or if I tap two times on an item the whole row with 4 items disappears.
This donāt have to be that difficult?
here is the List_viewer codeā¦
I am trying to save text in a text input box. Any ideas on how to do this? I would like to add a journal feature to my app. So users can add text, save the text and then add more text to the existing text when they reopen the app. I am new to thunkable! Thanks in advance.
And this is an example of the blocks you will need:
Create a variable to store all journal entries.
When the screen starts set the list to an empty list IF it does not contain anything, then update the list.
When updating the list, you simply want to populate a List Viewer component with all of the items in the list variable.
When a button is clicked, add the whatever is entered in a text input field to the list. Then update the list on the screen. Then clear out whatever was previously entered in the list.
I canāt seem to figure out a way to change the firebase path. With the example above, when I save the list I have a āfolderā called list in firebase at the root. but I actually want to save it as āfolder/listā instead of just ālistā (basically have the list in a separate area instead of the root).
Folders are created in Firebase by using ā/ā or by saving objects. My tutorial here explains that concept: https://youtu.be/htjhe0KEFBQ?t=807
Another option is to save your list as a cloud variable, then if you have firebase hooked up, each cloud variable will be a different folder in your firebase database. This is the newly suggested approach. Check out my most recent tutorial that explains this:
Except my problem is nesting one variable in another. So for instance, one stored variable āuserā with a cloud variable inside it called āfriendsā that contains a list. For some reason, I canāt for the life of me get that simple concept to work. I have tried an object and I have tried cloud variables and for some reason I canāt get a proper path to work.
Hello.
I would like to know if it is possible to delete an item from the list.
Your code from The Final Code save local the items but I am not able to delete them now.
I was reading all the post from here, but in the end it is not clear for me if it is possible or it is a bug that does not allow this.
If it is not possible, I guess would be helpful to update somehow also the info from your channel that sends here.
It is a great channel and would nice to keep it accurate.
Of course, you can remove an element from a list. This block:
is doing just that. You just need to know which index the item occupies (and for that, the āin list () find first occurrence of ()ā function can be used).
Note that this will NOT remove an item from a list stored in a database. For that, you need to
recover the database record using the key, and store it locally in the program (app variable)
remove the redundant element
save the amended list back to the database using the same key, so that the original version will be replaced.