# How do you use stored variables across screens in thunkable x?

**URL:** <https://community.thunkable.com/t/how-do-you-use-stored-variables-across-screens-in-thunkable-x/1618889>\
**Category:** Questions about Thunkable X\
**Created:** [November 16, 2021, 1:15pm UTC](https://community.thunkable.com/t/how-do-you-use-stored-variables-across-screens-in-thunkable-x/1618889 "2021-11-16T13:15:22Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ant\_1](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ant_1/32/183393_2.png) [@ant\_1](https://community.thunkable.com/u/ant_1)\
**Post date:** [November 16, 2021, 1:15pm UTC](https://community.thunkable.com/t/how-do-you-use-stored-variables-across-screens-in-thunkable-x/1618889/1 "2021-11-16T13:15:22Z")

</div>

I’m a beginner so please help on this one. So I know how to use stored variables in the same screen, but if you ask me how to use stored variables across screens, I don’t know. So if anyone could help me, that would be great!

Thanks.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [November 16, 2021, 1:24pm UTC](https://community.thunkable.com/t/how-do-you-use-stored-variables-across-screens-in-thunkable-x/1618889/2 "2021-11-16T13:24:31Z")

</div>

Exactly the same way you use it in one screen apart from the initialize block.

Once you initialize an app variable or a stored variable or a cloud variable it can then be used every where in the app just by using the `set variable block or assign its value to another variable or another component such as a `Label`.

---

<div class="post-metadata">

**Author:** ![ant\_1](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ant_1/32/183393_2.png) [@ant\_1](https://community.thunkable.com/u/ant_1)\
**Post date:** [November 16, 2021, 1:25pm UTC](https://community.thunkable.com/t/how-do-you-use-stored-variables-across-screens-in-thunkable-x/1618889/3 "2021-11-16T13:25:33Z")

</div>

thanks very much.

---

<div class="post-metadata">

**Author:** ![ant\_1](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ant_1/32/183393_2.png) [@ant\_1](https://community.thunkable.com/u/ant_1)\
**Post date:** [November 17, 2021, 12:35pm UTC](https://community.thunkable.com/t/how-do-you-use-stored-variables-across-screens-in-thunkable-x/1618889/4 "2021-11-17T12:35:07Z")

</div>

One question though @muneer, I know I should have asked this yesterday but there are two set variables in the variables section and i also don’t really get how to do it though. Do you mind sharing the blocks so can take a look of how it’s supposed to work. So I hope you don’t mind at all

Thanks a lot.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [November 17, 2021, 1:54pm UTC](https://community.thunkable.com/t/how-do-you-use-stored-variables-across-screens-in-thunkable-x/1618889/5 "2021-11-17T13:54:37Z")

</div>

These are the available variable types  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/9/19498a9d676f63b33bbaa994e1ee3e8e90584101.png)

When you add a variable you can select what type you want to initialize it to  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/d/fd2b141f0544f012e1b96ffa746c76e982c7cc56.png)

An `app variable` can have a default value (Initialized value). But the other two types can not be given a default value when initializing.  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/3/b38b35fd100b734c26ac8c1ad8b776ff7b55fa6b.png)

You can assign the variable different values using the `set block`  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/6/f672ec02e2869e9b6ac9c0bc94cf75bf17ca1fcc.png)

The main difference between an `app variable` and a `stored variable` is that the `app variable` will retain its value as long as the app is in use. Once the app is closed, the `app variable` is removed from memory.

The `stored variable` will retain its value even after the app is closed. This is useful for setup options or to store the user name of the user of the app.

The other set of variable are `dynamic variables`. They can be used anywhere and do not require initialization.  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/1/616dd045b9bb96b0c10dcd20e88df7ae31034fbe.png)

To read or display the value of the variable you use the block with the variable name this way.  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/b/bbc0ac7e32ec9e383358c5f07cb4134a6a91d1fe.png)

The documentation is covering the same but in details.

Hope this makes it clear.

---

<div class="post-metadata">

**Author:** ![ant\_1](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ant_1/32/183393_2.png) [@ant\_1](https://community.thunkable.com/u/ant_1)\
**Post date:** [November 17, 2021, 1:56pm UTC](https://community.thunkable.com/t/how-do-you-use-stored-variables-across-screens-in-thunkable-x/1618889/6 "2021-11-17T13:56:49Z")

</div>

Wow. This is a really good explanation. Thanks a lot.

---

<div class="post-metadata">

**Author:** ![ant\_1](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ant_1/32/183393_2.png) [@ant\_1](https://community.thunkable.com/u/ant_1)\
**Post date:** [November 17, 2021, 2:05pm UTC](https://community.thunkable.com/t/how-do-you-use-stored-variables-across-screens-in-thunkable-x/1618889/7 "2021-11-17T14:05:50Z")

</div>

But how will it know if a specific component is the stored variable?

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [November 17, 2021, 2:13pm UTC](https://community.thunkable.com/t/how-do-you-use-stored-variables-across-screens-in-thunkable-x/1618889/8 "2021-11-17T14:13:44Z")

</div>

The `stored variable` is a **variable** not a **component**. You can store any data you want and you can always check if it is null or the length is **0** which means it is **empty** otherwise it has a value that you have stored in a previous session of your app.

See this example  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/5/f5faaf8b6f418ce9df7e2fb07a2de1282ab35511.png)

---

<div class="post-metadata">

**Author:** ![ant\_1](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ant_1/32/183393_2.png) [@ant\_1](https://community.thunkable.com/u/ant_1)\
**Post date:** [November 17, 2021, 2:15pm UTC](https://community.thunkable.com/t/how-do-you-use-stored-variables-across-screens-in-thunkable-x/1618889/9 "2021-11-17T14:15:30Z")

</div>

Oh ok that is much clearer. Thanks. 🙂

---

<div class="post-metadata">

**Author:** ![ant\_1](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ant_1/32/183393_2.png) [@ant\_1](https://community.thunkable.com/u/ant_1)\
**Post date:** [November 20, 2021, 7:57am UTC](https://community.thunkable.com/t/how-do-you-use-stored-variables-across-screens-in-thunkable-x/1618889/10 "2021-11-20T07:57:22Z")

</div>

Hi @muneer,  
I have been experimenting with the `variables`

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/a/8adcbf2adbd2c4a98be78ec65b4037c799f8ace5.png)

The above code should display the text of the input box into 1 label or the other depending on the button I press.

When I use `app variable`, it works. However the when I switch to another screen, the value of the variable is reset to its initialised value.

When I use `stored variable`, it simply doesn’t work (within the screen).

What am I missing?

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [November 20, 2021, 9:55am UTC](https://community.thunkable.com/t/how-do-you-use-stored-variables-across-screens-in-thunkable-x/1618889/11 "2021-11-20T09:55:46Z")

</div>

Can you share your project so I can have a look?

---

<div class="post-metadata">

**Author:** ![ant\_1](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ant_1/32/183393_2.png) [@ant\_1](https://community.thunkable.com/u/ant_1)\
**Post date:** [November 20, 2021, 10:25am UTC](https://community.thunkable.com/t/how-do-you-use-stored-variables-across-screens-in-thunkable-x/1618889/12 "2021-11-20T10:25:43Z")

</div>

Sure, just let me get the link.

---

<div class="post-metadata">

**Author:** ![ant\_1](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ant_1/32/183393_2.png) [@ant\_1](https://community.thunkable.com/u/ant_1)\
**Post date:** [November 20, 2021, 10:29am UTC](https://community.thunkable.com/t/how-do-you-use-stored-variables-across-screens-in-thunkable-x/1618889/13 "2021-11-20T10:29:34Z")

</div>

Here is the link: [Thunkable](https://x.thunkable.com/copy/a29fd6da8287177d6621b86e03ee3581)

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [November 20, 2021, 10:43am UTC](https://community.thunkable.com/t/how-do-you-use-stored-variables-across-screens-in-thunkable-x/1618889/14 "2021-11-20T10:43:22Z")

</div>

I fixed the project. Check it  
[https://x.thunkable.com/projectPage/6198ce3396d8fe00102e6850](https://x.thunkable.com/projectPage/6198ce3396d8fe00102e6850)

note that this  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/8/f8cf5da418ede32338cf217381439e4e415862d6.png)  
is not similar to this  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/5/d5a0938079c0d4cc584a186b430c295526966e01.png)

---

<div class="post-metadata">

**Author:** ![ant\_1](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ant_1/32/183393_2.png) [@ant\_1](https://community.thunkable.com/u/ant_1)\
**Post date:** [November 20, 2021, 10:53am UTC](https://community.thunkable.com/t/how-do-you-use-stored-variables-across-screens-in-thunkable-x/1618889/15 "2021-11-20T10:53:58Z")

</div>

Thanks a lot for fixing my project.

Somehow, there must be a bug since the first time I previewed it, it worked, but now it doesn’t strangely.

Do you know the cause of this?

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [November 20, 2021, 10:56am UTC](https://community.thunkable.com/t/how-do-you-use-stored-variables-across-screens-in-thunkable-x/1618889/16 "2021-11-20T10:56:22Z")

</div>

I did not understand, can you explain?

Remember, I did not change the name of the project so make sure you preview the corrected one not the old one.

---

<div class="post-metadata">

**Author:** ![ant\_1](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ant_1/32/183393_2.png) [@ant\_1](https://community.thunkable.com/u/ant_1)\
**Post date:** [November 21, 2021, 3:38am UTC](https://community.thunkable.com/t/how-do-you-use-stored-variables-across-screens-in-thunkable-x/1618889/17 "2021-11-21T03:38:54Z")

</div>

I had previewed the new one and it seems that the buttons for storing don’t work when I type something in. Is this just me or is it for both of us?

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [November 21, 2021, 3:55am UTC](https://community.thunkable.com/t/how-do-you-use-stored-variables-across-screens-in-thunkable-x/1618889/18 "2021-11-21T03:55:27Z")

</div>

Can you explain in more details?

What are you doing and what are you expecting and what the app results in?

---

<div class="post-metadata">

**Author:** ![ant\_1](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ant_1/32/183393_2.png) [@ant\_1](https://community.thunkable.com/u/ant_1)\
**Post date:** [November 21, 2021, 6:38am UTC](https://community.thunkable.com/t/how-do-you-use-stored-variables-across-screens-in-thunkable-x/1618889/19 "2021-11-21T06:38:02Z")

</div>

So the problem is @muneer is that basically I when I type in the text that I want, and then click the either two of these buttons, it still shows it’s original text, and when I go back to screen 1, the text that I put in is not there.

---

<div class="post-metadata">

**Author:** ![ant\_1](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ant_1/32/183393_2.png) [@ant\_1](https://community.thunkable.com/u/ant_1)\
**Post date:** [November 21, 2021, 2:37pm UTC](https://community.thunkable.com/t/how-do-you-use-stored-variables-across-screens-in-thunkable-x/1618889/20 "2021-11-21T14:37:39Z")

</div>

There is a problem with the app @muneer. So when I type in the text that I want, it seems to not reply and put the text in the label as I click the button. Is this just me? Or is it actually not working?

[Next page](https://community.thunkable.com/t/how-do-you-use-stored-variables-across-screens-in-thunkable-x/1618889.md?page=2)
