# \[Solved\] Save attribute values

**URL:** https://community.thunkable.com/t/solved-save-attribute-values/1056160
**Category:** Questions about Thunkable X
**Created:** [January 18, 2021, 3:41pm UTC](https://community.thunkable.com/t/solved-save-attribute-values/1056160 "2021-01-18T15:41:26Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![jul.roy1311q9](https://avatars.discourse-cdn.com/v4/letter/j/76d3ee/32.png) [@jul.roy1311q9](https://community.thunkable.com/u/jul.roy1311q9)
#### Post date: [January 18, 2021, 3:41pm UTC](https://community.thunkable.com/t/solved-save-attribute-values/1056160/1 "2021-01-18T15:41:26Z")

</div>

Hi,

What’s the appropriate way to save some object attribute so that they remain the same if I close the app and then re-open it?

Specifically, I have checkboxes (buttons for which I change the background color when they are cliked, red=unchecked, green=checked). I would like the checkboxes to retain their state whenever I leave the app and comeback.

Here is a screen shot and my code so far:

 ![screenshot](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/3/e3f0deaf77e554f1bef6164ce40096fa0e8e6473.jpeg)

 ![screenshot2](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/1/013a97d0ee0976aa6f2c7e061bf05b91a1f63896.png)

---

<div class="post-metadata">

### Author: ![Kat\_Rostova](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/kat_rostova/32/93944_2.png) [@Kat\_Rostova](https://community.thunkable.com/u/Kat_Rostova)
#### Post date: [January 18, 2021, 5:47pm UTC](https://community.thunkable.com/t/solved-save-attribute-values/1056160/2 "2021-01-18T17:47:18Z")

</div>

Instead of using initialize “app” variables, try to just change each one to stored. Don’t forget to change the variables that are called to stored as well. Hopefully it works, if not, hopefully a more experienced thunker can jump in and tell me where I went wrong. 😁

Edit to add: from what I understand “app” variables only persist while the app is open. “Stored” variables persist in the user’s device even while closed.

---

<div class="post-metadata">

### Author: ![jul.roy1311q9](https://avatars.discourse-cdn.com/v4/letter/j/76d3ee/32.png) [@jul.roy1311q9](https://community.thunkable.com/u/jul.roy1311q9)
#### Post date: [January 18, 2021, 6:23pm UTC](https://community.thunkable.com/t/solved-save-attribute-values/1056160/3 "2021-01-18T18:23:10Z")

</div>

Thanks for answering!

So it’s not really the app variables for defining checked\_color and unchecked\_color that I want to get rid of. It’s that I want to save the attributes of my buttons but in a concise and efficient manner.

The following code is doing what I want, but the issue is that it doesn’t scale. If I had 20 buttons instead of 3 it would be a real mess:

 ![buttons](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/8/3834ecd048d9b4208ab8abd637a634a8255632c4.png)

---

<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: [January 18, 2021, 6:32pm UTC](https://community.thunkable.com/t/solved-save-attribute-values/1056160/4 "2021-01-18T18:32:04Z")

</div>

There is more than one way to do this. You can use a Local Data Source and store all button state in it. Every time the app starts it should read all values and update the app.

Another way is using the stored variable but make it a list. In the list put all the states for each button but you will have to remember them as sequence of numbers.

A better way is to use a stored object. In the object you but the button name and the color state.

In all methods you will need to go through a loop to read the values and update the buttons.

Hope that helps.

---

<div class="post-metadata">

### Author: ![jul.roy1311q9](https://avatars.discourse-cdn.com/v4/letter/j/76d3ee/32.png) [@jul.roy1311q9](https://community.thunkable.com/u/jul.roy1311q9)
#### Post date: [January 18, 2021, 6:35pm UTC](https://community.thunkable.com/t/solved-save-attribute-values/1056160/5 "2021-01-18T18:35:49Z")

</div>

I see! I think I figured it out with Stored Variables. Thanks for the help!

 ![buttons_scalable](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/e/1e083f42d7d166775a90cd45411c4ea3c51b064f.png)

---

<div class="post-metadata">

### Author: ![Kat\_Rostova](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/kat_rostova/32/93944_2.png) [@Kat\_Rostova](https://community.thunkable.com/u/Kat_Rostova)
#### Post date: [January 18, 2021, 6:43pm UTC](https://community.thunkable.com/t/solved-save-attribute-values/1056160/6 "2021-01-18T18:43:05Z")

</div>

Glad you were able to figure it out. Wish I had been able to help more. Happy thunking!

---

<div class="post-metadata">

### Author: ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)
#### Post date: [November 8, 2024, 1:30pm UTC](https://community.thunkable.com/t/solved-save-attribute-values/1056160/7 "2024-11-08T13:30:42Z")

</div>


