How to set a stored variable from a text input?

I’m not really sure how to explain this one with my lack of lingo, but on the post below, I can only see a stored variable being set when an event occurs that has a designated result (such as ‘value’, ‘result’ etc):

https://docs.thunkable.com/variables#app-stored-and-cloud-variables

I’m hoping to be able to store a number that is typed into a box and display it permanently within the app until another number is put in. But this doesn’t come with a ‘result’ or ‘value’ to use and I’m not sure how to translate that into my need.

EXPLANATION

The image above is an attempt at explaining the process, but here’s a video which may shed more light on what I mean. Basically, when you see the ‘33’ pop up - essentially that’s what I need to stick around until it’s changed again. This doesn’t need to be stored in a database - I just need it to be there when the app is closed and reopened.

I think I understand the differences between the different variables now as some users explained them really well in one of my previous posts, but using them is a different story!

Thank you! :slight_smile:

You are storing the CARB_INPUT text for later use, correct? If so, I don’t see where the value is stored, it looks like the “updateRecentRatio” function is never called. Are there more blocks?

Hi @KaneoheKid, sorry about that - those are just remnants from things I had tried before!

OK, try looking at this project:

https://x.thunkable.com/copy/d7486fcab6e8a449834b8d91de9f9ad7

It stores your last saved variable and keeps it, then displays it when you start the app the next time (“Screen1 Opens” block). Is this what you are trying to do? I did the same thing with a map, just to show a slightly different use. Hope this helps.

1 Like

Hi @KaneoheKid, thank you for this! It’s populating the label field but it is resetting to the original number after the app is relogged into - how can I avoid this? I assumed the stored field would be constant until changed?

The problem is that you have two similarly named variables. When the submit_IC_button is clicked, you save the “CARB_INPUT Text” into the temporary variable named appCarbRecent. Therefore, each time you quit the app, that value evaporates. You need to change that block to “stored CarbRecent” which is a variable that persists.

You will still need to load the stored variable result when the screen starts, use the “When Home_Screen Opens” block as i demonstrated in the example.

Hi @KaneoheKid, thank you for this - I apologise this is taking me so long to grasp. I have now amended these elements but it still will not work - I feel as though the ‘when home screen opens’ bit may need to be done differently, can you let me know?