# Different local\_storage's do not return the different data when the key is the same

**URL:** <https://community.thunkable.com/t/different-local-storages-do-not-return-the-different-data-when-the-key-is-the-same/1079452>\
**Category:** Questions about Thunkable X\
**Created:** [February 2, 2021, 10:56am UTC](https://community.thunkable.com/t/different-local-storages-do-not-return-the-different-data-when-the-key-is-the-same/1079452 "2021-02-02T10:56:30Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![itsiniki](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/itsiniki/32/90333_2.png) [@itsiniki](https://community.thunkable.com/u/itsiniki)\
**Post date:** [February 2, 2021, 10:56am UTC](https://community.thunkable.com/t/different-local-storages-do-not-return-the-different-data-when-the-key-is-the-same/1079452/1 "2021-02-02T10:56:30Z")

</div>

when I:  
store “one” in local\_storage1 with key “thisisit”  
store “two” in local\_storage2 with key “thisisit” (the same key)

when I:  
retrieve key “thisisit” from local\_storage1 the result is “two”  
retrieve key “thisisit” from local\_storage2 the result is “two”

The result from local\_storage1 should be “one” because I am using different local\_storages

What is happening?

[https://x.thunkable.com/projects/60185cb295b0480019e25e98/e9c7b7f4-41fe-4c97-ae02-9098922444ba/blocks](https://x.thunkable.com/projects/60185cb295b0480019e25e98/e9c7b7f4-41fe-4c97-ae02-9098922444ba/blocks)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [February 2, 2021, 7:16pm UTC](https://community.thunkable.com/t/different-local-storages-do-not-return-the-different-data-when-the-key-is-the-same/1079452/2 "2021-02-02T19:16:37Z")

</div>

There’s something strange going on for sure.

I would recommend using **stored** variables instead of local storage: [Local Storage - ✕ Docs](https://docs.thunkable.com/local-storage)

---

<div class="post-metadata">

**Author:** ![itsiniki](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/itsiniki/32/90333_2.png) [@itsiniki](https://community.thunkable.com/u/itsiniki)\
**Post date:** [February 2, 2021, 7:28pm UTC](https://community.thunkable.com/t/different-local-storages-do-not-return-the-different-data-when-the-key-is-the-same/1079452/3 "2021-02-02T19:28:58Z")

</div>

Thank you.

I was doubting my results until I decided to make that basic example and came to the conclusion that I was experiencing something odd.

I am now in the process of adding a marker to the key so that every key is unique, to avoid further mix-up.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [February 2, 2021, 7:44pm UTC](https://community.thunkable.com/t/different-local-storages-do-not-return-the-different-data-when-the-key-is-the-same/1079452/4 "2021-02-02T19:44:29Z")

</div>

Why not just use stored variables since that’s the recommendation by Thunkable staff? Or if you need a bunch of them, use a local data source (local db).

---

<div class="post-metadata">

**Author:** ![drted](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/drted/32/92694_2.png) [@drted](https://community.thunkable.com/u/drted)\
**Post date:** [February 2, 2021, 8:49pm UTC](https://community.thunkable.com/t/different-local-storages-do-not-return-the-different-data-when-the-key-is-the-same/1079452/5 "2021-02-02T20:49:29Z")

</div>

I had the same issue with Google sheet based data sources. One of the many reasons I now use firebase exclusively.

> <https://github.com/thunkable/thunkable-issues/issues/640>
>
> \### Platform
> IDE
> 
> \### Issue/Request Origin
> When using a Google Sheet with 2 …sheets as a data source, GetValue block only works correctly for the first sheet. 
> 
> \### Steps to Reproduce
> 1. Click the FIRST button and the contents of the first value in the FirstName column is populated in the textbox (A)
> 2. Click the LAST button and the contents of the first value in the FirstName column is populated in the text box (A). THe correct value would be (X).
> 
> The click events are identical, except the GetValue block references the second sheet in the workbook.
> 
> \### Project Link
> https://x.thunkable.com/copy/218120dc1055303f464ab05d223b8264 
> 
> \### Data Source Link
> https://docs.google.com/spreadsheets/d/1p9aikeUzYkuhGhIXRceIsWJ3mQIJg6tuBIa9XhadKp8/edit?usp=sharing
> 
> \### Expected Behavior
> The LAST button should retrieve the first value from the LastName column in the LAST Sheet (X)
> 
> \### Actual Behavior
> Execution halts with no results being displayed

> [@Get data problem](http://community.thunkable.com/t/get-data-problem/758007):
>
> Why can only get the first page but not the second page?

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [February 2, 2021, 9:10pm UTC](https://community.thunkable.com/t/different-local-storages-do-not-return-the-different-data-when-the-key-is-the-same/1079452/6 "2021-02-02T21:10:32Z")

</div>

But this is local storage… not even a spreadsheet. Just individual keys that store data locally on the device. It’s just an outdated way of using stored variables.

---

<div class="post-metadata">

**Author:** ![drted](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/drted/32/92694_2.png) [@drted](https://community.thunkable.com/u/drted)\
**Post date:** [February 2, 2021, 9:43pm UTC](https://community.thunkable.com/t/different-local-storages-do-not-return-the-different-data-when-the-key-is-the-same/1079452/7 "2021-02-02T21:43:06Z")

</div>

Sorry, my bad! I was thinking local db. 😳

---

<div class="post-metadata">

**Author:** ![itsiniki](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/itsiniki/32/90333_2.png) [@itsiniki](https://community.thunkable.com/u/itsiniki)\
**Post date:** [February 3, 2021, 9:16am UTC](https://community.thunkable.com/t/different-local-storages-do-not-return-the-different-data-when-the-key-is-the-same/1079452/8 "2021-02-03T09:16:43Z")

</div>

I am using sets of different data that can be modified locally to be combined to show different results. It needs to be accessible offline, so I have to store the data on the device.

The info on Local DB page says: “At present, changes made to your Local DB data will not be stored across app sessions.”

So it seems that I have no other option than to use either local\_storage (which I am using right now) or the stored variables, yes?

---

<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:** [February 3, 2021, 9:31am UTC](https://community.thunkable.com/t/different-local-storages-do-not-return-the-different-data-when-the-key-is-the-same/1079452/9 "2021-02-03T09:31:14Z")

</div>

Yes you are correct. The `Local DB` does not retain data across sessions but the `Local Data Storage` does.

You need to note that `Local DB` is JSON based but `Local Data Storage` is table based.

---

<div class="post-metadata">

**Author:** ![itsiniki](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/itsiniki/32/90333_2.png) [@itsiniki](https://community.thunkable.com/u/itsiniki)\
**Post date:** [February 3, 2021, 9:31am UTC](https://community.thunkable.com/t/different-local-storages-do-not-return-the-different-data-when-the-key-is-the-same/1079452/10 "2021-02-03T09:31:54Z")

</div>

Thank you!

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [February 3, 2021, 3:57pm UTC](https://community.thunkable.com/t/different-local-storages-do-not-return-the-different-data-when-the-key-is-the-same/1079452/11 "2021-02-03T15:57:55Z")

</div>

Hopefully it’s clear from what @muneer wrote but just in case it’s not, local data storage uses a Local Data Source that you create (table based / spreadsheet) in Thunkable and then pre-populate and/or populate using blocks from the Data Source drawer.

See this: [Data Sources - ✕ Docs](https://docs.thunkable.com/data-sources)

---

<div class="post-metadata">

**Author:** ![itsiniki](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/itsiniki/32/90333_2.png) [@itsiniki](https://community.thunkable.com/u/itsiniki)\
**Post date:** [February 4, 2021, 1:51pm UTC](https://community.thunkable.com/t/different-local-storages-do-not-return-the-different-data-when-the-key-is-the-same/1079452/12 "2021-02-04T13:51:08Z")

</div>

Thank you!

---

<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:29pm UTC](https://community.thunkable.com/t/different-local-storages-do-not-return-the-different-data-when-the-key-is-the-same/1079452/13 "2024-11-08T13:29:37Z")

</div>


