# Local data base

**URL:** <https://community.thunkable.com/t/local-data-base/120185>\
**Category:** Questions about Thunkable X\
**Created:** [June 25, 2019, 11:49am UTC](https://community.thunkable.com/t/local-data-base/120185 "2019-06-25T11:49:52Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![geralhivl](https://avatars.discourse-cdn.com/v4/letter/g/d2c977/32.png) [@geralhivl](https://community.thunkable.com/u/geralhivl)\
**Post date:** [June 25, 2019, 11:49am UTC](https://community.thunkable.com/t/local-data-base/120185/1 "2019-06-25T11:49:52Z")

</div>

Hey Guys!  
Im still new to Thunkable and Im having a hard time with using the local data base…  
So in my app, I got a sensor working, and I wanted for a couple of seconds, to store the sensor data in a local datebase so later on I would be able to read the smaller/bigger value retrived by the sensor…  
Is it possible? Can anyone help me out?

---

<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:** [June 25, 2019, 3:12pm UTC](https://community.thunkable.com/t/local-data-base/120185/2 "2019-06-25T15:12:35Z")

</div>

Hi there,

You can use blocks like this to save your value to a DB:  
 ![save2db](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/7/572ec9c79c4e195c358cd0e56dfa6461dc0ee008.png)

Then use blocks like this to get the highest value:

 ![gethighestval](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/8/58424e3a435724cdfef0c3032e1a25b1e1639b6c.png)

The ‘max of list’ block can be found in the Lists drawer of blocks:  
 ![ran](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/2/a2bdfb92719cab377c06f76df1860483d0d73667.png)

![getoflist](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/e/8ef2459ddc7fd3efd1aa60bdaae10db2ee2a7e38.png)

As you can see form all of the options, you can do some great analysis on your data with this one block!

---

<div class="post-metadata">

**Author:** ![geralhivl](https://avatars.discourse-cdn.com/v4/letter/g/d2c977/32.png) [@geralhivl](https://community.thunkable.com/u/geralhivl)\
**Post date:** [June 26, 2019, 8:47am UTC](https://community.thunkable.com/t/local-data-base/120185/3 "2019-06-26T08:47:16Z")

</div>

Thank you so much for the help!  
But is there a way to actually take a look at the data that got saved in the data base? I thought it would be posible to check it out on the table created once you creat the local DB…

---

<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:** [June 26, 2019, 8:54am UTC](https://community.thunkable.com/t/local-data-base/120185/4 "2019-06-26T08:54:19Z")

</div>

You could use a label or the listviewer to display the contents of, for example, the `Magnet_X` column.

---

<div class="post-metadata">

**Author:** ![geralhivl](https://avatars.discourse-cdn.com/v4/letter/g/d2c977/32.png) [@geralhivl](https://community.thunkable.com/u/geralhivl)\
**Post date:** [June 27, 2019, 1:05pm UTC](https://community.thunkable.com/t/local-data-base/120185/6 "2019-06-27T13:05:47Z")

</div>

![39](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/8/582c6d63d501697cf413e725033481b74b8c6243.png)

right now I have this… But Im not able to show of storage the values… Can anyone help?

---

<div class="post-metadata">

**Author:** ![joannietw](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/joannietw/32/30139_2.png) [@joannietw](https://community.thunkable.com/u/joannietw)\
**Post date:** [June 27, 2019, 1:41pm UTC](https://community.thunkable.com/t/local-data-base/120185/7 "2019-06-27T13:41:25Z")

</div>

@geralhivl, can you share you project link to me via private message? Have checked the code above but can’t find any strange. I think I need to check deeper on your component and other blocks.

Thanks.

---

<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:** [June 28, 2019, 11:01am UTC](https://community.thunkable.com/t/local-data-base/120185/8 "2019-06-28T11:01:30Z")

</div>

Light green blocks, like yAcceleration in your example, are local variables that are visible only inside the block in which they are defined. Therefore, your blocks does not work.

---

<div class="post-metadata">

**Author:** ![geralhivl](https://avatars.discourse-cdn.com/v4/letter/g/d2c977/32.png) [@geralhivl](https://community.thunkable.com/u/geralhivl)\
**Post date:** [June 28, 2019, 11:03am UTC](https://community.thunkable.com/t/local-data-base/120185/9 "2019-06-28T11:03:34Z")

</div>

Sorry you got me a bit confused there…  
How can I fix it?

---

<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:** [June 28, 2019, 11:22am UTC](https://community.thunkable.com/t/local-data-base/120185/10 "2019-06-28T11:22:55Z")

</div>

Use variable block.

myVar \< yAccseleration

then use to save to the myVar to store it value

If you don’t know what local and global variables are, here’s some information about it.

### Global Variable

A **global variable** is a variable that can be accessed in multiple scopes. This means that wherever you are in the program you can use that variable; get its current value or set its value to something else. Global variables are created using the initialize global name to block found in the Variables drawer.

### Local Variable

A **local variable** is a variable that is declared within a function or it is an argument passed into a function. This means that you can only access these variables in that specific function where they are declared or passed in as an argument.

---

<div class="post-metadata">

**Author:** ![geralhivl](https://avatars.discourse-cdn.com/v4/letter/g/d2c977/32.png) [@geralhivl](https://community.thunkable.com/u/geralhivl)\
**Post date:** [July 11, 2019, 11:02am UTC](https://community.thunkable.com/t/local-data-base/120185/11 "2019-07-11T11:02:38Z")

</div>

@actech so… I should initialize a new variable? then I need to get myVar = YAcceleration, and then change to myVar every field that is now set as Yacceleration?

Im sorry really trying to understand this 😕

---

<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:** [July 11, 2019, 11:24am UTC](https://community.thunkable.com/t/local-data-base/120185/12 "2019-07-11T11:24:56Z")

</div>

Yes, you need to create a new variable if you want to use the received data outside the scope of the local variable.

---

<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, 12:12pm UTC](https://community.thunkable.com/t/local-data-base/120185/13 "2024-11-08T12:12:16Z")

</div>


