Data Sources & Local DB

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
Screen Shot 2021-09-26 at 10.08.12 PM
Screen Shot 2021-09-26 at 10.08.21 PM

1 Like

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. :thinking:
Or, instead of Local_Db use Airtable Or GoogleSheet that keeps values.

1 Like

See this from Thunkable documentation
image

Thanks @muneer @mimostel I’ll work with Data sources :ok_hand:

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…

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.

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

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?

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?

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
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.

@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.

1 Like

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

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.