Variable scope definition in X platform

quick question:
does variable in Thunkable X global?
will it keep its value when moving from screen A to screen B?
I remember in the classic version we could define the scope to global however I’m not sure in X version.

Thanks in advance. :slight_smile:

1 Like

No, you need to store it in a localstorage

Thanks, this is what I thought.

Tell me if you need any help :slight_smile:

Good day :slight_smile:

It actually looks like the variable blocks have been updated—but still waiting documentation from Thunkable on these changes.

Yes, we just changed how variables work. When you make an “app variable” it will work throughout your app, on all screens! The documentation will catch up soon.

Example project:
https://x.thunkable.com/copy/ead3b7a96c728c7a75403d8d5e886dd7

yes I can see now. nice addition.
we have: App, Stored and cloud. waiting for documentation.

image

App variables work across screens, and are re-initialized when the app starts (make sure you have the latest companion app for this to work). Stored variables get saved on the device (same thing as local storage), and cloud variables are stored in firebase (same as realtime db).

Thanks, do you know what will become with variables that was set prior to this change ?

Previous variables work exactly the same way as they always have - the only exception is that we’ve removed the create variable button (since it’s better to create app variables).

Nice, too bad there was no documentation/announcement of this change. Now I stumbled on this thread by accident…
Would be nice if this type of changes would be announced somewhere :wink:

That’s our bad. Normally something like this would have at least been mentioned in our release notes. Sorry about that.

-Mark

Is there documentation coming for the new variable infrastructure? I have functions that worked fine before the update and now don’t work.

For example I set variable to an empty object, then set a property int hat object to an input, convert to a json, then send as an API POST body. It worked fine before, but now doesn’t set the property and ends up sending an empty json. Any ideas?

That’s why I check the release notes a couple of times each week. Especially on Wednesdays since it looks like your sprints normally end around that day :stuck_out_tongue_winking_eye:
Anyway, nice improvement. Good that it’s in the release notes now.

You should update to the latest version of Thunkable Live.

Thanks for the info, I checked that earlier and am up to date

@Michael_Mckenna, Can you send us a share link to a simple example of the behavior that your seeing?

Thanks in advance.

-Mark