From today rowID not work in "Create a local data source"

Hi @steven, I just wanted to reconnect on your message. 3 days have passed and we still are waiting a fix for this. You mentioned that the deadline for the release was yesterday or even the day before.

Could you please let us know when this will be fixed? Thanks!

2 Likes

The fix from last week is no longer working. Creates and updates do not work.

Please check:
https://x.thunkable.com/projects/5f4967f43313e4debddcb87e/3eba1be8-e3d4-4e65-950f-1d48144656f6/designer

Update does not work properly, does not get to alert because it crashes.


Also note that when this project is duplicated, the AirTables are munged.
https://x.thunkable.com/projects/5f51defcf21990e5364928a4/3eba1be8-e3d4-4e65-950f-1d48144656f6/designer
See bug #655.

The tables have not worked for a couple of days, I sure hope it will be fixed before the weekend.

Hi @Steven,

any progress in fixing the issues with Local Databases and their missing row IDs?

1 Like

Hi everyone,

Sorry for the delay, I recently moved to a new apartment and haven’t been online for a few days.

@Michael_Rogulla I understand what you’re saying. I have a fix for the row id block. So my question is just clarifying as to whether or not that was the only issue you were seeing. Obviously it creates other issues since you’re unable to reference the id but if nothing else is currently broken it is helpful to clarify that to ensure there isn’t anything I’m missing that I need to look into. It looks like this fix is live on the site. I just created a simple test project and it does return the newly created id. Can you please check and confirm? You should not need to make any changes to your project for it to work but if it doesn’t work at first please try moving a block associated with the relevant screen and trying again.

@athornock Thanks for the suggestion, I’ll take a look and see if that is something we’re able to do. In the meantime, we did recently add a new block to allow you to get all the values for a row (including the id) in an object so I think that will help serve your use case.

@Tommaso As I mentioned above, the fix for the row id block should be available, please test and let me know if that has fixed your issue. In regards to your other issue I’ll have to take a closer look and get back to you. There are a lot of potential things that could be going wrong so I’ll let you know once I have a better idea as to what it might be and how we can get it fixed. I believe you sent me a direct message so I’ll work with you on it in that thread going forward.

@mrtwocanes I don’t see anything wrong in your blocks. Do you have any restrictions on your Airtable columns? I believe it will fail to update if you attempt to set a column with the Number type to a text value. Is it possible there is a conflict between the value you’re sending and what Airtable expects? Feel free to message me directly and I can help you with this issue.

For Android it works in a live test. Not for iOS.
The new component does not work!

Steven, unfortunately, the updated component does not work as it should.

In the project https://x.thunkable.com/projects/5d70f93f8a62b4079eedaff2/project/properties/designer/

on the scrLocalDBFilteredRecords screen, there is a list at the top, but clicking on entries 1,2,3 doesn’t work. The record click handler only works for records 4 and higher

Hi @Steven and @actech,

thank you for the update, I found that the “create row…” block now gives us a rowID. But maybe there is some finetuning needed, because it is still not possible to iterate through all rows and delete them.

Let me explain it: I found a way to clear all rows in a local datasource in actech’s “ACtech demo 2020”, big thanks to actech. The code looks like in the following block. I alway wondered why a simple loop with integers (and not row IDs!) worked, but it worked:

The function “deleteLdb2” wipes all rows from a local db! This is necessary, when you want to refresh the data in a local DB because the user enters a new filter expression. For me it used to work (2 weeks ago…) that way:

    1. screen starts: get all data from an airtable by “get all rows”, store it in a list.
    1. when the user enters a filter expression:
      – delete the local datasource
      – iterate over the list, and populate the local data source when filter matches
      – go to the screen with the data viewer list/grid, which has the local datasource as its source.

When user gets back to start and enters a new filter, it starts again by “2)”. This block above used to work. Interesting: Right now it only works for the first time: a local datasource is persistent (I don’t know why), so it is necessary to delete all rows, because there may be some data from the last run.

One solution for me would be to correct this behaviour in the block “delete row in …” so I can use integers from 1 to length( local database) as before
-or-
create a new block with the simple, but speaking name “delete all rows in …” for local databases. Personally I would prefer option 2, it saves maybe some time, but option 1 would enable existing apps to work again.

BTW: I found this error in all environments: “Preview” on a firefox browser, “Live companion” on iOS and “Live companion” on Android. Guess it would be the same in APK or downloaded iOS app.

EDIT: when I try to use the block "delete row in " on a locald DB with one of the ID, that were returned during creation, the app crashes.

Hi @Steven, I just found the new block “get row object from”. Great, thank you, this gives some new interesting opportunities.

The next thing would be to have the id also in the block “list of values in …” from a local database like this:

grafik

Then it should be easy to iterate over all IDs and do whatever you like, for example delete some or all entries.

I see a problem when using Data Viewer and can’t explain it until it is fixed. Data Source and Data Viewer are very complex components and so far I see only one reliable solution - it is to use the AirTable REST API and Custom ListViewer.

@Balanced_Kitchen Sorry what exactly isn’t working?

@actech I see, it seems like the update block isn’t working in that scenario? I’ll take a look at it and let you know what I find. Thanks for providing an example. For your last post, let me know if there is anything specific to take a look at. They are complex components and not really similar to anything we’ve done before.

@Michael_Rogulla I’ll take a look at the delete block and see if there are any issues I can find. Does your label ever get updated with an error message? If so, that would be helpful for me to determine the issue. I think adding the id as a possible value to get in the list of values block seems reasonable enough so I’ll look into it.

Hi, @Steven
after the update of Thunkable live for iOS everything works correctly.
About the new block: I only managed to create a JSON file. If this is its only purpose - it works correctly.

@Steven. My question was solved (I changed the algorithm). I could not understand why, in Data Viewer, records were displayed, and when clicking on some of them, the click processing block was not triggered. I think this is due to the specifics of updating data, when the list displays data from the cache, but in fact they are not already in the DataSource.

I think you also understand that us need a block to update data. A swipe gesture is a non-obvious list update. Otherwise, we will constantly get confused with what the Data Viewer displays the real list or the list from the cache.

1 Like

Hi @Steven,

so I could narrow down the error. I’ve written a simple app to test creating, viewing and deleting rows and found out:

  • everything works as expected now. I am able to create some rows, I can delete a single row or I can delete all rows.
  • then I switch to screen2 where a data viewer list resides. It uses the local data source and it displays the local datasource correctly (green button “View Data”)
  • but when I go back to the first screen, every operation on the local datasource (create, delete) crashes the app

I can reproduce this behaviour on preview, iOS live companion and Android live companion.

I looks like the data viewer list takes a grip on the local datasource on first view and then prevents further changes to it. Here is my sample project:

https://x.thunkable.com/projects/5f59e082c22d07967782afad/project/properties/designer/

I see a problem. This is similar to the fact that when switching to another screen, the reference to the data object is lost, which causes a crash when any block is called again from the main screen.

Hi @actech and @Steven,

is the problem “reference lost to data object” being worked on at thunkable?

I do not know this because I am not a member of the development team. For this reason, I can only offer a complex Custom ListViewer, which is slow but more reliable.

I had a similar need when working with an Airtable base. The _id is a property of the row object but can’t be accessed directly through the DataViewer blocks or the getColumn block in Spreadsheet. My workaround was to use the formula feature in Airtable to add a column that shows the _id. This column can then be accessed. I can’t see an obvious way to do that for a local data source other than a loop that gets each row object, and copies the rowID into a cell.

Hi @shane.holohan1864qsw,

that is the reason why I request the thunkable team would add this field “ID” to the block “list of values in” which is available under “Data sources”. Right now this block offers all columns from a local data source, but not the ID.

_id is the internal ID of the string. I understand that it is convenient to use, but in practice, the table author assigns unique values for each record. This can be a serial number or article, or product code. You may ask, how can I use this code to find a row in the table? You don’t need to do this if you use an associative list of objects with access to them through this unique code. Another way is to create a loop over all the table entries and determine the row number using this code.

Roughly speaking, this is what I’ve done.
In my use case access to the _id is not just convenient but necessary. My data is stored in Airtable and I track many-to-many relationships (eg students and teachers and the classes they teach/attend). The linked field in Airtable shows names in Airtable but the JSON that imports into the Thunkable app for the field is an array of _id values not names. To find the names you have to search a list of _id’s, find the right row, then extract any data from that row.