Some Variable Related questions

I’m a bit confused. Newb Thunker but veteran coder.

Part 1: If the phone has a value stored on the phone for a STORED variable, is the Initialize Block ignored on the next load of the app and / or the next visit to the screen that initialized it? Seems like that’s the behavior but not sure. If the initialize isn’t ignored, then how do you create STORED variables once and just leave them alone to be referenced on subsequent launches of the app?

Part 2: Can STORED variables persist across multiple Live View sessions (in the UI or using Thunkable app on a phone) or are they wiped between sessions? If wiped, how do you guys test features that assume vars are stored from a previous session?

Part 3: If you create a CLOUD variable is this globally shared between all users of the app? If so, how do you do cloud based storage at a user level?

Thanks in advance

Keifer

Part 1: Yes, STORED variables are initialized once and then never again.

Part 2: Yes, STORED variable values persist across app sessions.

Part 3: Not sure… someone else will have to help you with that one.

1 Like

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

^^^i built this app around that idea

1 Like

Thanks both. It’s definitely becoming clearer. Part of my confusion was that I had moved an INIT to a different (upstream) screen and all of the references on the original screen broke. I didn’t realize I just had to re-select the same variables again and all was good. There’s also some false information in threads here that APP values are available across all screens but STORED values aren’t. Perhaps that was how it was at one point?

Apps variables are definitely accessible across screens. Are you experiencing something different?

1 Like

No, I’m finding consistency now. For a while I was having issues with a store variable that was throwing me off. It was a situation where there were many read/writes/manipulations of the variable going on throughout a screen, including inside functions, but I found that I could get around it by:

  • at the top do: set APPvalue = STOREDvalue
  • do what I need to do using the APPValue
  • at the end set STOREDvalue = APPvalue ready for next session

This worked. Not sure why but happy to have a work around.

Thanks

Keifer

I’ve used that method. You really should only need a STORED variable to do all of that but for reasons I can’t explain, I’ve also set it up that way. :rofl:

1 Like