# Pulling data from Local storage with any component

**URL:** <https://community.thunkable.com/t/pulling-data-from-local-storage-with-any-component/373058>\
**Category:** Questions about Thunkable X\
**Created:** [December 18, 2019, 1:55pm UTC](https://community.thunkable.com/t/pulling-data-from-local-storage-with-any-component/373058 "2019-12-18T13:55:20Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![bobbyj12](https://avatars.discourse-cdn.com/v4/letter/b/d26b3c/32.png) [@bobbyj12](https://community.thunkable.com/u/bobbyj12)\
**Post date:** [December 18, 2019, 1:55pm UTC](https://community.thunkable.com/t/pulling-data-from-local-storage-with-any-component/373058/1 "2019-12-18T13:55:20Z")

</div>

The any component works great for storing large data all at once, i.e. whether or not 100 switches are on or off. How can you use the Any component to pull all of this data at once and put it into your app? If you can’t, do you have to use a separate statement for each switch?

---

<div class="post-metadata">

**Author:** ![domhnallohanlon](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/domhnallohanlon/32/29554_2.png) [@domhnallohanlon](https://community.thunkable.com/u/domhnallohanlon)\
**Post date:** [December 18, 2019, 2:06pm UTC](https://community.thunkable.com/t/pulling-data-from-local-storage-with-any-component/373058/2 "2019-12-18T14:06:08Z")

</div>

You can definitely do something like this @bobbyj12 with the “all switches on Screen1” block, or similar

---

<div class="post-metadata">

**Author:** ![bobbyj12](https://avatars.discourse-cdn.com/v4/letter/b/d26b3c/32.png) [@bobbyj12](https://community.thunkable.com/u/bobbyj12)\
**Post date:** [December 18, 2019, 2:49pm UTC](https://community.thunkable.com/t/pulling-data-from-local-storage-with-any-component/373058/3 "2019-12-18T14:49:36Z")

</div>

@domhnallohanlon do you have an example of how this would work please?

---

<div class="post-metadata">

**Author:** ![jane](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jane/32/27575_2.png) [@jane](https://community.thunkable.com/u/jane)\
**Post date:** [December 18, 2019, 3:24pm UTC](https://community.thunkable.com/t/pulling-data-from-local-storage-with-any-component/373058/4 "2019-12-18T15:24:42Z")

</div>

Hi @bobbyj12,

Are you familiar with working with [lists](http://docs.thunkable.com/lists) in your app?  
You can treat the block ‘all Switch in Screen1’ as a list.

As an example, these blocks will go through every switch in Screen1.  
For each switch, if the value of the switch is **true** , it will write a ‘1’.  
If the value of the switch is **false** , it will write a ‘0’.

 ![switchlist](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/4/44fdcb5eebca8af08b743a1f730f5a3decdb1d27.png)

You can use something like this to pull all of the data related to your switches and put it into your app (or a spreadsheet, or a realtime DB, etc).

---

<div class="post-metadata">

**Author:** ![domhnallohanlon](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/domhnallohanlon/32/29554_2.png) [@domhnallohanlon](https://community.thunkable.com/u/domhnallohanlon)\
**Post date:** [December 18, 2019, 3:30pm UTC](https://community.thunkable.com/t/pulling-data-from-local-storage-with-any-component/373058/5 "2019-12-18T15:30:39Z")

</div>

Would something like this work for you?

 ![Screenshot_20191218-145019](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/5/f55257c034766945f9bf77af0fefc214b2bbbc6f.jpeg)

Here’s a link to my project @bobbyj12  
[https://x.thunkable.com/copy/e2efa92d7207e562d0db6ccb7415c73a](https://x.thunkable.com/copy/e2efa92d7207e562d0db6ccb7415c73a)

---

<div class="post-metadata">

**Author:** ![bobbyj12](https://avatars.discourse-cdn.com/v4/letter/b/d26b3c/32.png) [@bobbyj12](https://community.thunkable.com/u/bobbyj12)\
**Post date:** [December 18, 2019, 5:26pm UTC](https://community.thunkable.com/t/pulling-data-from-local-storage-with-any-component/373058/6 "2019-12-18T17:26:16Z")

</div>

Thanks. I understand now. Let me give it a try.

---

<div class="post-metadata">

**Author:** ![bobbyj12](https://avatars.discourse-cdn.com/v4/letter/b/d26b3c/32.png) [@bobbyj12](https://community.thunkable.com/u/bobbyj12)\
**Post date:** [December 19, 2019, 4:53pm UTC](https://community.thunkable.com/t/pulling-data-from-local-storage-with-any-component/373058/7 "2019-12-19T16:53:33Z")

</div>

Hello guys, I tried the blocks above but they still do not work. The switch colors change and the label changes to “1”. However, when I back out to screen 1 and load screen 2, the switch show off and grayed out, Please look at these blocks and let me know what I’m doing wrong. Thunkable x is definitely a different animal .

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/c/2ce8e4a953e918e613b0aa766762677a019086f2.png)

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [December 19, 2019, 7:00pm UTC](https://community.thunkable.com/t/pulling-data-from-local-storage-with-any-component/373058/8 "2019-12-19T19:00:42Z")

</div>

Hello,

The loop uses an asynchronous purple block - this is the problem. First you need to get all the data in the loop, and you need to save the data in the purple block outside the loop.

---

<div class="post-metadata">

**Author:** ![bobbyj12](https://avatars.discourse-cdn.com/v4/letter/b/d26b3c/32.png) [@bobbyj12](https://community.thunkable.com/u/bobbyj12)\
**Post date:** [December 19, 2019, 7:05pm UTC](https://community.thunkable.com/t/pulling-data-from-local-storage-with-any-component/373058/9 "2019-12-19T19:05:54Z")

</div>

I thought I was doing that by setting the colors when the switch is on and then saving the values from those block in the local storage block.

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [December 19, 2019, 7:39pm UTC](https://community.thunkable.com/t/pulling-data-from-local-storage-with-any-component/373058/10 "2019-12-19T19:39:14Z")

</div>

If you do not know the difference between asynchronous and synchronous blocks, then I recommend the information at [http://droidscript.ru/main/statyi/thunkablex\_base7.php](http://droidscript.ru/main/statyi/thunkablex_base7.php)

---

<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, 11:46am UTC](https://community.thunkable.com/t/pulling-data-from-local-storage-with-any-component/373058/11 "2024-11-08T11:46:18Z")

</div>


