How to stop repeating data in data viewer list, let say i have ShopA then i will load all products in the data viewer list1, then i want to switch another shop to ,ShopB and i want to load it in the same data viewer list1…
I would add, that “row id” is handled differently:
when using a ggogle sheet as a data source, you can count from 1…n
when using airtable as a data source you have cryptic strings as row ids.
To delete all entries in a data list viewer (airtable) you have to store and handle all existing row ids. That’s why I requested a function “from DataListViewer deleteAllEntries” (see https://github.com/thunkable/thunkable-issues/issues/615).
Let me also add that the row IDs will be different if you work with AirTable directly from the DataSource. But instead, you can work with Airtable via Local DB, where indexes are used to delete records.
You may ask, how do I delete entries in the AirTable itself? Yes, for this case, as you said, you need an additional function to clear the entire AirTable table at a time. But then I have a question: why do I need to delete all entries from the AirTable table? Can you give at least one example when such an operation is necessary?
But other than that, there is the coolest way. You can insert an invisible Unicode character in the text of the correct answer. When you click the button, you check whether the response text contains this invisible character. If it contains, the answer is correct.
But there is an even more interesting solution with additional protection against cheating the answer (if your students are too smart and understand how to find out the correct answer from the answers). But I don’t think you need to make that decision.
I want to use the new Data List Viewer with filtered data. That is the reason for my request “delete all entries” in the local database. I do not want to delete the airtable data.
This is my setup, maybe there is a better solution, if so let me know please:
I get a whole table (let’s say a list with restaurants) from airtable
the user can select the kind of restaurant and then I apply a filter to the list of restaurants and want to display the result with the Data List Viewer, ok? For this reason I use a Local Database. I fill this local database with the results of my filter operation and the Data List Viewer displays the selected restaurants and the local database as its source.
The tricky part is, the local database must be cleared, before filling it with my results. Otherwise the local database fills up, even after a new start of my app!!! The local database is some kind of “stored variable”, it is persistent. I want to show only the actual results, not older data.
It is possible to handle all IDs and then delete then one-after-another in the local database, but it would be more efficient to clear then all with one “delete all entries”. The local databse is only used for temporary storage.
I have shown you one of the options for deleting all records from the local table. If it doesn’t work for you, then create a theme on github and write what the bug is. If my method works, then the problem is solved. Or am I wrong?
Hi @farmershubbysheg, I had a look at your app. What exactly isn’t working? Does the list of stores show up?
I have worked very often with airtable and I suggest to use two different airtable components:
one for the stores
one for the products
I remember, that the block “from airtable set tableName to …” has not alway worked as expected. How about a different approach:
store all products in one table
add a column with the store name
define as many views as needed for each store. Every view contains a filter for exactly one store. That way you use the block “from airtable set ViewName as…”. I cannot guarantee that this will work but it is less complicated to have one table for work with and to maintain the structure.
Thank you, i just try it, i think its a good option
The app are now working a bit, but still load the old datas, the backend part is working, deleting previous data, but it wont happen realtime in the data listview, you still need to refresh it before it load the new data… its working, its not repeating or combine from the previous data… the only matter now is it need to refresh…
so as I understand you correctly the app does its job but the data list viewer does no refresh? I have seen a good trick to refresh the data in a tutorial from darren: https://youtu.be/cccFpkrKPPw
Basically, there is no refresh block or function. But as a workaround:
add a blank screen. Call it as you like for example “refreshscreen”
add only one element to this screen: a loading icon
add only one block: “when refreshscreen.starts navigate to DataListScreen”
And then after entering / changing / deleting the data in the data list viewer add a block “navigate to refreshscreen”. When using your app, the refreshscreen shows up for a second (the loading icon) and jumps back to the last screen and the data list is refreshed.
it would be sweet to see a live refresh, but this requires webhooks that our DB’s arent providing to our thunkable apps as far as i know (except for the realtimeDB).
its keep looping even tho the screen is already switch to other screen, the previous screen still running… then if i use to break the loop it will just store 1 data…
yes, the new sreen does nothing but showing a loading icon (or an image or anything else). In its “when screen opens” block there is only one block "navigate to ". I tried it and it works, the problem is, that a “navigate to” - block does not close the screen, so you end up with more and more open screens in the background.
I have seen this trick in a video tutorial from Darren. A data list viewer only refreshes, when its screen shows up. So we have to reopen the screen, but with the drawback, that the previous screens sum up.