# Data Sources & Local DB

**URL:** <https://community.thunkable.com/t/data-sources-local-db/1528793>\
**Category:** Questions about Thunkable X\
**Created:** [September 27, 2021, 5:19am UTC](https://community.thunkable.com/t/data-sources-local-db/1528793 "2021-09-27T05:19:59Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![exploriverse.com](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/exploriverse.com/32/77609_2.png) [@exploriverse.com](https://community.thunkable.com/u/exploriverse.com)\
**Post date:** [September 27, 2021, 5:19am UTC](https://community.thunkable.com/t/data-sources-local-db/1528793/1 "2021-09-27T05:19:59Z")

</div>

I finally figured out how to “Update value in” and “Set Cell” to change data in my data bases.

In the iOS thunkable test app both are changing the data while testing the app BUT

When I close the app and relaunch it…

The saved data from “Set Cell” in the Local DB changes didn’t stick.  
Where as the saved data from “Update value in” in the Data Source does stick.

Is this a known behavior of iOS thunkable test app? Why are the local DB changes not staying?

@domhnallohanlon

![Screen Shot 2021-09-26 at 10.07.52 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/f/9ff8ce8108af07034f90318acc445f0564b7ffc5.png)  
 ![Screen Shot 2021-09-26 at 10.08.12 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/f/dfa441adee7020c4cf0501ec2d34ac65053b749f.png)  
 ![Screen Shot 2021-09-26 at 10.08.21 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/b/abaaef1baac1ab7d0cc80afd0c909718481342ca.png)

 ![Screen Shot 2021-09-26 at 10.16.57 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/5/750efc5c28e6b934384cb2e27838ff473ed8bdf4.png)

---

<div class="post-metadata">

**Author:** ![mimostel](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mimostel/32/107661_2.png) [@mimostel](https://community.thunkable.com/u/mimostel)\
**Post date:** [September 27, 2021, 6:39am UTC](https://community.thunkable.com/t/data-sources-local-db/1528793/2 "2021-09-27T06:39:47Z")

</div>

From my knowledge, Local\_Db are just tables created and used in a sesion. They dont keep values between sessions. All you do is only keeping some references of those tables saved between sessions (as row, column), but when you start another session those are refering to a value from an empty table.  
If you want to keep that table filled with values between sesion, you need to put all table in a “stored” variable, as a created object with multiple layers with all values from table. 🤔  
Or, instead of Local\_Db use Airtable Or GoogleSheet that keeps values.

---

<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:** [September 27, 2021, 9:57am UTC](https://community.thunkable.com/t/data-sources-local-db/1528793/3 "2021-09-27T09:57:36Z")

</div>

See this from Thunkable documentation  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/d/7d43c8f5abc9d5b3feb11347b6758fddb1e2f131.png)

---

<div class="post-metadata">

**Author:** ![exploriverse.com](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/exploriverse.com/32/77609_2.png) [@exploriverse.com](https://community.thunkable.com/u/exploriverse.com)\
**Post date:** [September 27, 2021, 2:23pm UTC](https://community.thunkable.com/t/data-sources-local-db/1528793/4 "2021-09-27T14:23:59Z")

</div>

Thanks @muneer @mimostel I’ll work with Data sources 👌

---

<div class="post-metadata">

**Author:** ![exploriverse.com](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/exploriverse.com/32/77609_2.png) [@exploriverse.com](https://community.thunkable.com/u/exploriverse.com)\
**Post date:** [September 27, 2021, 3:34pm UTC](https://community.thunkable.com/t/data-sources-local-db/1528793/5 "2021-09-27T15:34:44Z")

</div>

I switch all the “update value” “get value” to data source. All of it is working but 1. What could be going on?

I’m able to update the ‘exp’ cell in a button action. Yet its not updating when I have it in a function (highlighted in red)

In the function I update other cells so I know ‘update value’ block works. Doing more troubleshooting…

 ![Screen Shot 2021-09-27 at 8.29.06 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/7/97b47c6637effade348d9f2db6cf83b0a18c8488.png)

---

<div class="post-metadata">

**Author:** ![exploriverse.com](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/exploriverse.com/32/77609_2.png) [@exploriverse.com](https://community.thunkable.com/u/exploriverse.com)\
**Post date:** [September 27, 2021, 3:51pm UTC](https://community.thunkable.com/t/data-sources-local-db/1528793/7 "2021-09-27T15:51:55Z")

</div>

Ok I isolated the block that is not working. By putting them in a button.

It’s the “update value” using the variable ‘expCow’ after I changed it to 0.

 ![Screen Shot 2021-09-27 at 8.47.31 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/d/1d8f22eab12e23be8b4b9cdbca52b61541a4df4b.png)

Weird since the “update value” where I update it by 4, is working in this button blocks. Any explanations?

 ![Screen Shot 2021-09-27 at 8.50.00 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/8/489b72be5c6c42daac975e950f73e27703df1ea7.png)

---

<div class="post-metadata">

**Author:** ![exploriverse.com](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/exploriverse.com/32/77609_2.png) [@exploriverse.com](https://community.thunkable.com/u/exploriverse.com)\
**Post date:** [September 27, 2021, 4:01pm UTC](https://community.thunkable.com/t/data-sources-local-db/1528793/8 "2021-09-27T16:01:46Z")

</div>

I put this “update value” in an initializes or changes and it doesn’t save ‘expCow’ variable to the cell.

I’m stuck. What’s going on?

 ![Screen Shot 2021-09-27 at 8.59.53 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/8/b8b5fdedd16ac3c3620a954447205219d381920d.png)

---

<div class="post-metadata">

**Author:** ![exploriverse.com](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/exploriverse.com/32/77609_2.png) [@exploriverse.com](https://community.thunkable.com/u/exploriverse.com)\
**Post date:** [September 27, 2021, 4:05pm UTC](https://community.thunkable.com/t/data-sources-local-db/1528793/9 "2021-09-27T16:05:38Z")

</div>

Here is a better way to show it.

The “update value” highlighted in green works.

The “updated value” highlighted in red doesn’t work.

Explain?

 ![Screen Shot 2021-09-27 at 9.04.03 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/f/af1d40f8d0b95feb1e40fa4bff825f9e2d88bb44.png)

---

<div class="post-metadata">

**Author:** ![mimostel](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mimostel/32/107661_2.png) [@mimostel](https://community.thunkable.com/u/mimostel)\
**Post date:** [September 27, 2021, 4:37pm UTC](https://community.thunkable.com/t/data-sources-local-db/1528793/10 "2021-09-27T16:37:16Z")

</div>

Try to put some “wait 0.001” after each update purple block.  
And when im using function to put there some repetitive blocks, i usually use some app variable, lets say “waiting” … just like in the following example  
 ![screen](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/a/bac393fc40ce232c623f6e44cf0c1f5fad2b8cd9.png)  
this way the program will prevend going further before what i need to do its done.  
Working with data sources is kinda tricky, as @muneer tought me, and program needs a lil time to retrieve/save data from/to it.

---

<div class="post-metadata">

**Author:** ![exploriverse.com](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/exploriverse.com/32/77609_2.png) [@exploriverse.com](https://community.thunkable.com/u/exploriverse.com)\
**Post date:** [September 27, 2021, 6:42pm UTC](https://community.thunkable.com/t/data-sources-local-db/1528793/11 "2021-09-27T18:42:39Z")

</div>

@mimostel putting in wait time didn’t help.

@domhnallohanlon Could be an issue with data source column or the ‘update value’ block. Work around was I had to create a new column in the data source and reference the new column in my blocks.

---

<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:** [September 27, 2021, 7:00pm UTC](https://community.thunkable.com/t/data-sources-local-db/1528793/12 "2021-09-27T19:00:15Z")

</div>

So, you are saying if the variable is 4 it is saved but if the variable is 0 it is not saved. Is this the issue you are facing?

Can you try `update value` with numbers other than 0 or 4 and see what happens?

**[Edit]**

I made this quick project to test  
[https://x.thunkable.com/projectPage/615215dd5f77d3001095c614](https://x.thunkable.com/projectPage/615215dd5f77d3001095c614)

You are **correct**. If the value is **0** the block will not save. But if you change it to **text** instead of number then it will save it correctly.

---

<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:15pm UTC](https://community.thunkable.com/t/data-sources-local-db/1528793/13 "2024-11-08T13:15:03Z")

</div>


