Global vars no longer defined after Spreadsheet1 .Got Column

Pretty much had it all working the way I wanted, then
BOOM! Somehow my global vars were no longer defined after Spreadsheet1 .Got Column finished. The lblInfo and lblInfo2 labels display correctly the list lstPersonalItems itself and the length of lstPersonalItems, ie,

“Eat Drink BeMerry Do Mary” and 4

Then, after the initPersonal proc has finished running, the labels are set again, but now lstPersonalItems is no longer defined:

Now the labels display: () and 0

How does a global variable lose its definition from the Spreadsheet1 Got Column to the very next step? :confounded:

As always, any help is greatly appreciated.

Well, i think because when you got data from Spreadsheets, The variable lstPersonalItems will be set to the values you’ve got from the database.If you got an empty list from spreadsheet.The variables will be set to empty list.
Also when you set a global/local variable to another value, all old value will be replaced with the new value, so when you set the variable to empty list, all of your data in your variable will be replaced with empty list.
If you want to keep old and new data to together you can make something like this:
1- If you have a list and you will get a new items you want to add in this list make something like : for each item in list values:
add item in list oldValues( your old list ), item = the item variable (for each item in list)
2- if your value a string and you want to add a list :
add item to NewList , item = (your old string)
And then make the step above :wink:

1 Like

Why do you use a variable as a column name? If the names of the columns never change. You should put a text block with the exact name of the column

Captura de pantalla 2020-09-18 171207

Thanks for your reply. I use variables for my column names (and Table names, API Keys, BaseIDs) to prevent spelling errors. I’ve tried it both ways and it makes no difference using vars instead of text blocks. global Status = “Status”.

And what about this:

Thank-you for your reply. The variable lstPersonalItems is set to the Spreadsheet1 .Got Column values. The list has 4 items and IN the Spreadsheet1 Got Column routine, the lstPersonalItems contains 4 list items and can be displayed via the lblInfo and lblInfo2.

After the initPersonal procedure’s .Got Column is finished running, the initTables procedure tries to display the lstPersonalItems and the data is missing.

I set up a Test project and it works perfectly.

Maybe someone can spot what is different, but I think there’s a bug related to Spreadsheets…like using too many or replacing them too many times in my project.

1 Like

So you get an empty list from airtable :thinking:

No. I do not get an empty list. As I’ve explained, the list in the Got Column routine gets the data and displays in the labels in that routine.

AirTables is not the problem, there are no empty rows or cells, the data is there; the last blocks I showed clearly indicates the data is there, the “procedure” labels show the expected Table columns. These blocks work perfectly. The data gets loaded and is displayed by “procedure” after the Spreadsheet1 .Got Column finishes.

The initial blocks I posted do not work. The AirTable table is the same table. After the Got Column finishes, the data disappears.

Thank-you for your efforts.

I’ve meant in your main blocks in the first post (that isn’t working for you)) :thinking:Is the data you got is empty list??

And btw,when you put your blocks for setting label under the if-then statement.it will execute before you got all data.I suggest you to put them in the else if condition.

The data I get is never an empty list. Getting the data is not the problem, keeping it is the problem. :grin:

So see this.

You may get the data before you’ve set it.

I do not know what you mean by “get the data before I’ve set it”. The data can be set and retrieved while still in the .Got Column. How do I get it outside the .Got Column?

OK, I’m not even using the if loop at this point, and the problem still exists. Here’s another way to look at this problem. I used a TinyDB to show that the data has been retrieved and can be displayed, unlike the lstPersonalItems.

Screenshot from 2020-09-18 10-59-40

lblInfo1 displays “16”, which is the number of items in the returned list.
lblInfo2 displays “0”, because the lstPersonalItems has lost its data.
lblInfo3 displays the entire list as it exists in AirTables. The TinyDB doesn’t lose the data. :crazy_face:

Turns out, TinyDB does lose the data if I want to access it outside of the .Got Column. I cannot believe this problem exists and nobody else has the problem and nobody has a solution.

What about removing, set LstPersonalItem to empty list , from SetupPersonalAirTableAndLists.
Any way, the set block will overwrite what you’ve set, so no need for resetting it.

Tried that yesterday, and again just now. No Joy.

I still think it’s a bug caused by using 15 spreadsheets and then trying to reuse one of those, and after that, using a brand new spreadsheet still does not work.

The problem is only in my app project/copies. It does not happen in new test projects. My app is fairly large, so I’d rather not rebuild it from scratch. I may have to do that. :scream_cat:

Try to use “copy list” block. I had some similiar issues.

Tried the Copy List, no joy. Like I said, the code works fine when isolated to a new project. It fails when using it inside existing projects.

Thanks for your reply!