Table schema issue

I have recently been trying to add a column to the Google Sheet that our app runs off of in order to add a new van to our app so that inventory can be assigned to it. The Google Sheet that the column is being added to is the source that two of our companyโ€™s apps run off of. So, when adding the column, I have to regenerate the schema for both apps. I'll add the column to the Google Sheet, regenerate the schema for both apps, then change the type of the column to the appropriate type and save my changes.

At first glance, both apps seem to be running fine with no backend error warnings from AppSheet, and both are displayed with no errors on the side viewer. However, other users of the app will then report the following issue: "Unable to fetch app definition. Error: There is a mismatch in the number of columns between the spreadsheet for Electrical Parts and the table schema. The table has 37 columns, but the schema has 36 columns. Please regenerate the table column structure. Error: Data table 'MidwestMachineLLCInventory-5543514:1.001077:Electrical Parts' is not available. Error: The data for this view cannot be found. Please select a new data table in the view settings."

This error persists for all users other than me on the inventory app, while the other app that runs off the same Google Sheet has no issues for any users. I will then refresh my browser, and I will encounter the same error, but only on the inventory app. I can fix the error on my end by regenerating the schema again, and the app will start to work, but if I refresh my browser again, the error will come back. Has anyone else ever run into this issue? My apologies for the long read

Solved Solved
0 5 948
1 ACCEPTED SOLUTION

Steve
Platinum 5
Platinum 5

The single most important thing is to avoid putting anything in any data (non-header) cell of the new column. The occurrence of anything in a data cell instantly brings the column into existence and will cause the problem you've seen for any version of the app that isn't expecting a column there.

To add a new column:

1) Add the new column at the end of all existing columns. Do not insert the new column between existing columns. Do not add any data or spreadsheet formulas in the new column; only add the header.

2) Regenerate the column structure for the table. Perform only minimal configuration of the new column, such as disabling Show? to avoid confusing the users. Do not add any configuration that might give or allow the column a value: no App formula, no Initial value, no Spreadsheet formula, disable Editable?.

3) All users must resync the app to get the new column before you perform any further configuration or use of the new column. So long as you don't add any data to the new spreadsheet column, earlier app versions should entirely ignore it.

4) After all users have resynced and have the latest version of the app, you may configure and begin using the new column. There is no way to force a resync, the users themselves must trigger it. There is no way to check whether all users have updated. It's on you to notify them and to impress upon them the importance.

View solution in original post

5 REPLIES 5

Steve
Platinum 5
Platinum 5

The single most important thing is to avoid putting anything in any data (non-header) cell of the new column. The occurrence of anything in a data cell instantly brings the column into existence and will cause the problem you've seen for any version of the app that isn't expecting a column there.

To add a new column:

1) Add the new column at the end of all existing columns. Do not insert the new column between existing columns. Do not add any data or spreadsheet formulas in the new column; only add the header.

2) Regenerate the column structure for the table. Perform only minimal configuration of the new column, such as disabling Show? to avoid confusing the users. Do not add any configuration that might give or allow the column a value: no App formula, no Initial value, no Spreadsheet formula, disable Editable?.

3) All users must resync the app to get the new column before you perform any further configuration or use of the new column. So long as you don't add any data to the new spreadsheet column, earlier app versions should entirely ignore it.

4) After all users have resynced and have the latest version of the app, you may configure and begin using the new column. There is no way to force a resync, the users themselves must trigger it. There is no way to check whether all users have updated. It's on you to notify them and to impress upon them the importance.

Thank you very much for the detailed response! For anyone looking at this post in the future, I believe the main cause of the issue was that I was inserting the new column in-between previously existing columns. Once I just inserted the column at the end I did not run into any issues regenerating the structure. 

For me this issue was apparently caused by Appsheets not pushing the latest version to users. Going into Manage > Versions > Stable Version and clicking the "Show all users the latest version" seemed to kick things off. It says by default it should do this but for some reason it wasn't. It now hasn't had an issue since. May not be the same scenario but another option to try. 

Steve is spot on with the best ways to avoid this in general.  I often do add new fields in the middle while I'm developing still and with that my experience with this has been similar to @skwokz when I'm testing.  Something that I found in a post a while ago was if you put "?refresh=1" after the ID in the url (or after the platform=desktop if in desktop mode), it forces it to pick up the updates.  here is the post   https://www.googlecloudcommunity.com/gc/AppSheet-Q-A/Cannot-get-new-version-of-app-without-using-Inc...

Hi Jason! Does this "?refresh=1" solution solve the problem where the app doesn't run correctly because the previous version is cached? I have problems where I create new fields and functions in the app, but many users still have the old version, and the problem is only solved when they clear the cache and cookies. Do you think this solution would work in this scenario?