I'm having problems with local storage for my running total app

So I’m making an app when a button is pushed it adds to the running total (dollar amount). I’m having problems with the local storage blocks. I don’t know what I’m doing wrong. I’m trying to use it in the test live and then I get out but when I get back in to the test live, nothing is saved. Here are my blocks.

Part of the problem is that you seem to be using the running total value as a key. I assume you’re storing the dollar amount there. The “key” is just a location name for your value. So the key would be something like “saved total” and the “value” would be the actual numeric amount that you are keeping track of. So when you Get the value from storage, you would need the key to have the location name and the value would have the numeric value you are storing. So you’d need to set Amount 1’s Text to the green value block when the screen opens.

But… you should be using stored variables to save single data items or a Data Source to save table data. I’m not sure why the Local Storage block is even still available in Thunkable.

See the note at the top of the documentation for Local Storage: Local Storage - Thunkable Docs.

@tatiang thank you. It works great

1 Like

@tatiang sorry to be a bother. It’s the last thing that I need to do and I’m done. I hope I can explain it okay. I have the same screen design and the same blocks for seven screens (copied from save my screen) I want when day one ends the amount total to begin again at zero but on day two it starts off with the total amount from day one. I’ve tried renaming the variable by adding a two after it and I day one has local storage 1 and day two has local storage 2, but it still leaves off with the total from day one.

My first thought when I hear that someone has multiple screens that are very similar is that it’s almost always easier and more efficient to program this all in a single screen. But if you have seven screens then that’s what you have to work with at this point.

It sounds like you need seven variables or a data source (table) that can store different values. I would use a data source unless you don’t want to bother with learning how to do that. So when day one ends, you would set the variable (or data source row) for day 2 to the variable (or data source row)'s value for day 1 and then set the variable (or data source row) for day 1 to zero.

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