Help needed with a Local Table Data Source problem

Hi community members,
I am still new to Thunkable and maybe I am doing something wrong, or my thoughts are wrong, but I have a problem with the Local Data Source.
For one of my first projects, I am working on an app to keep track of my scale models.
I followed the instructions of the Thunkable Academy Tutorial.
Things like they are working.
But in this tutorial, it will show all the data I have in my Google Sheet.
Now I am also watching and following a YouTube tutorial on how to get a filtered view.
This is not working and I already saw a different topic here that is about this problem and I am busy looking into this.

Now I had also the thought of using a local data source.
Just to see how that would work.
For now, it is not working.
Because of some problems I am having, someone told me to keep it simple and see if that would work. Then go from there.
I have created 1 button, that will write one line of data to my local data source.
When I go to the data editor and check my local data source, it is empty.
Some told me that this is normal and that you need to use a data viewer to see the data.
So I created a new screen, placed a data viewer list component, and set it to read my local data source.
To my surprise, the list stays empty.
Just to make sure, I created a new Google Sheet and placed one line of data in there, by using a button that writes one line of data to the Google Sheet.
In the web preview, I press the button, exit the web preview, and go to my Google Sheet, the data is there.
In the test app, when I go to the new screen and set the data viewer list component to read from my Google sheet, it will display the data on the screen.
Just to make sure, I had go to the data editor, and in my local data source, I manually placed one line of data in there.
In the test app, I set the Data Viewer List component to read from my local data source.
When I use the web preview, it will show the data.

I am puzzled.
If I use the button to place one line of data in my local data source, it will not show in the data viewer list.
When I place the same line of data in my Google Sheet, it will show in my data viewer list.
When I place the data manually in my local data source, then the data viewer list, will show the data.

Does anyone have any idea what is going on here?
I hope my explanation is clear and hope someone can explain it to me in a simple way.
Many thanks in advance. :slight_smile:

Are you using the stored data tables or the app data tables @pierre.demanbyd3x?

I think what you’re describing is actually the expected behaviour, but no harm to dig a bit deeper here/confirm this is the case

@domhnallohanlon
What do you mean by the stored data tables or the app data tables?
I had go to the data section on the left side.
There I tapped the +
From the pop-up window that open, I had click on Create New.
From there I choose the option Create your own table
Once the table is created, I will use it in the app.

This is then the local data source I will use in my test app.
As I mentioned, I cannot write to it.
But if I place manually data in that table, I can read from it.

In the blocks, I use the create a new row in (the created data source) and try to write data to it.

I am still new to all of this, so maybe I am doing something wrong, but no idea what.
Writting data to a Google Sheet is no problem. Also reading from a Google Sheet is no problem.

This is a link to the documentation of the table that I am using.
Thunkable Documentation.
I hope someone can help me.
Thanks :slight_smile:

When using a local data source, you will not see changes made to it while editing the project. So if you write new data to the data source, you will need to assign the cell’s value to a label’s text to confirm that the change occurred.

@tatiang
This is what I have so far;


To display it;
2023-09-21_19-18-20

Button2 is to go back to the home screen.

But the first problem is, that I cannot get data in the created table, when I press the Test button.

Can you show me what I need to do so it will work?
Many thanks in advance for your time and help. :slight_smile:

I understand that the Data Viewer List will not display the data source values. But what I suggested is that – as a troubleshooting step – you first make sure you can display a single cell value from the data source in a label after creating a new row.

Did you get that to work?

2 Likes

@tatiang
For this, I need to work with variables?
And the block (“get property” “of object”) ?
So I can use the label component?

No. You can use the get value block to get a single cell’s value from a data source. You don’t need a variable for that.

See this: Data Sources Blocks - Thunkable Docs

1 Like

@tatiang
Okay, I did the following.
These are the blocks for when I press the Test button.

Then when I press the button, it will go to my screen2
This is the output on screen;

These are the blocks on screen2;

This is the design of screen2;

When I change the row ID from “id” to “1”
The text null on the output is gone and it stays empty/blank.

I hope this is a bit clear.

You definitely need a row id. It’s fine to use integers as you did with the value 1. That should show you the cell value for the “Model” column in the first row of your data source.

Can you share a link to your project?

@tatiang
I wanted to share a link but first I wanted to clean it up a bit.
I was busy removing some old blocks, that were not working anymore, and suddenly everything was gone.
I will try to recreate the things I had and once it is done, I will share a link.

@tatiang
I have recreated the blocks

Just ignore the Data View List on the home screen.
The blocks for that are missing.
Also just ignore screen1
The plan was, that when you click on a model, you would go to screen1 and see more details.
But as I mentioned, the blocks for that suddenly disappeared.
The idea is, that you press the Test button on the home screen.
This will place a new entry in the file.
Then you press the other button and you will go to screen2 and you should see the data in the local data source.
The button on screen2 will bring you back to the home screen.
This is the link to the project;
https://x.thunkable.com/copy/fc2a67cf54bb72e200ff57fbfe19c4d7

This was a test for this project, but it is also a test for a different project that I have in mind.

Oke.
I have been working on this for some days now.
I started a new project, to keep track of my medication.
But also with this, things are not working the way I thought they would.
On my “home” screen I have a list of some medications.
I am using a local data source for this.
In this local data source, I manually placed some medication in there, so I had something to work with.
I also created a custom data_view layout.
When I start the web preview, I can see the medication I had entered manually.
So far so good.
When I tap on a medication, it will go to a details screen, this also works fine.
With a back button, I go back to my “home” screen.
Now I wanted to “ADD” new medication to the list.
I followed all the steps shown in the Thunkable tutorial named “How to Create Data in a Thunkable Data Source”
When testing it through the web preview, the following happens.
On my “Home” screen I see the current list of medications.
At the button, I have a + or add button.
When I press this, I will go to my ADD medication screen.
I can enter the name, dosage, usage, and stock.
When I press the SUBMIT button, I will go back to my “home” screen and I can see the newly added medication in the list.
When I exit the web preview and look at my local data table, the newly added medication is not there.
Now, someone told me that this was correct. Only with a data_view_list or grid, you would see the data.
A bit strange, but okay.
Now I start the web preview again, but the newly added medication is nowhere to be found.
Does anyone have any idea of what is going on here?
I could switch to a Google Sheet because that is working. However, I wanted this data to be available offline. That is why I thought of using a local data source.

Many thanks in advance for all the help. :slight_smile:
Please keep in mind, I am still new to Thunkable, so try to keep it simple :wink:

In order to help you, we need a link to your project.

Are you using an App Local Data Source or Stored Local Data Source? See the bottom-right corner of this screenshot for the location of that property:

It shows me “Stored Data Source”


This is what it is showing when I created the table.

This is the link to the project;
https://x.thunkable.com/copy/40adf2fde0bbb6d2eb19094e8ab5a9af

I previewed your project in a browser and saw this initial list of medications:

After adding a new medication called “TEST”, I exited the web preview and then started the preview again. The new medication appears on the screen:

That is the expected behavior for a stored data source. You may have a mistake in your blocks. Try deleting all rows from the data source (using the Data Source blocks) and then preview your app again to see if that makes a difference.

Thanks.
After your reply, I tested the project through the Thunkable Live app on my mobile device.
I had added 1 medication and it showed up. I exited the project and closed the Thunkalble Live app
I started the Thunkable Live app again, and the added medication was there.
On my computer, I opened the project and started the web preview.
The medication I had added on my mobile, was not there.
Okay, this is logical, because it is stored locally on my device.
Just to try something, I started the web preview on my computer and added a test medication.
I had exit the web preview.
Started again the web preview and the test medication was there.
I had exit the web preview again.
Went to the database tab on the left side and opened the local data source to see what was in there.
The test medication was not there.
I had opened the web preview again and the test medication was gone.

For me, this means, that every time I open the local data source to check something, everything I had added during the web preview session will be gone after I start the web preview again.
I am not sure if this is normal or not but I find it strange.

Can you maybe explain to me what is the difference between “Stored Data Source” and “App Data Source”?

No, that’s not correct. When you add something to a stored data source or stored variable, it is saved to the device (either mobile or desktop/laptop).

When you view the Data Source while editing the project, you can only see the original data you entered. That view is no longer accurate after you modify the data source using blocks while previewing the app. But… the data is still saved/modified. It just won’t appear that way.

1 Like

Okay.
I think it is clear now.
But I also think that it is a little bit tricky.
If you are testing in the web preview, and want to change or modify your local data source, all your test data will be gone.
In some cases this is okay, but it is something to keep in mind.