Save GetAllRows in Stored var

Hi All,
I am trying to save the “rows” block (coming from the Airtable “GetAllRows”) in a stored variable. In particular, it is possible to copy the data retrieved in an app var but not in a stored var - two things to highlight:

  1. if I save the “rows” block in a stored var, it doesn’t get the data and the function below froze
  2. if I save the “rows” block through the “get object properties” block the data seem retrieved and the function below don’t stop. However, it seems that if I then try to use the data through the “for each J in list” block, I can’t access the data retrieved.

Nothing seem working - I have tried to store the data in:

  • stored variables
  • local data source
  • local storage
  • I have also tried to convert the data in JSON but the information seem too much

Just for clarity: at the moment my app retrieves around 3000 rows from Airtable at start, and it takes around 25/30 seconds to have the data in an app var. It would be good if I could store the data in a stored var and don’t download again the data from Airtable at each access.

Anyone has solutions/suggestions?

1 Like

Get object properties should not work for you so that is not an option.

Have you saved the JSON of your GetAllRows to a stored variable? It should work.

I save my rows to a stored variable and have no problems.

1 Like

I just tried this, using a stored variable. 2.5-3 seconds to retrieve all rows (2000 rows, 3 columns each) from airtable AND save them to a stored variable.

Then it’s less than 0.1 seconds to read the stored variable and display the contents on a label. Note that I’m only making json in order to be able to show that there’s data, not because that’s useful or necessary here.

I’m not sure how you’re getting 25-30 seconds. Very slow internet? Very old phone? If you post blocks, we might be able to help more.

1 Like

@catsarisky @muneer

Many thanks for your testing and suggestions. This is what I got with further testing on different phones:

  1. Samsung S9: I am able to retrieve around 1000 rows without problems. When I go up to 1500 it doesn’t work. However, if I include the “get object properties” block I am able to retrieve all the 3000 rows but I cannot use them in “for each item J in list”. Is there a way to go back from the “get object properties” block?
  2. iPhone XS: everything works perfectly.

Here are my blocks:
Capture
I am able to see the list of [object Object] in the alert text on iPhone XS - but not on Samsung S9

I guess at this point it could be an issue of old phone (it shouldn’t be related to different OS considering that with the Samsung S9 I am able to retrieve 1000 rows without problems).

Another point to be considered is that the columns I am trying to retrieve are 15 - could also may this be the reason? Too many information to be stored in stored var?

In addition, if I use the below set of blocks everything works perfectly aside of the fact that it’s really slow retrying the data:
Capture2

  1. On Samsung S9 = 13.6 seconds
  2. On iPhone XS = 10.1 seconds
    (P.S. I said 25 seconds because then I am able to display the data in another screen in around 25 seconds - so please disregard this info of the 25 seconds, it’s instead around 13 seconds)
1 Like

I made my airtable 2000 rows by 9 columns. (And now Airtable is complaining that I’m over the limit.)
Storage and retrieval are still working (older iphone), and although retrieval /displays/ .15 seconds, there’s actually a 1-2 second lag while the screen updates.

I booted up my trusty Android device, a 2018 Kindle Fire. 6 seconds to store. Multi-second wait for the label to render, although the timer shows 0.130 seconds to actually read. 0.030 seconds to retrieve if I don’t make json and write it to a label. So if your problem is Android related, it isn’t all Androids, and my geriatric kindle isn’t affected. Or maybe my airtable isn’t big enough to trigger the issue yet. I’ll try making it even bigger. Maybe there’s some Android limit and I just haven’t hit it yet.

[Update: I duplicated my data and now have 4000 rows, 6 columns. Getting the rows object takes 6-8 seconds, but I can still store it as a stored variable, even on the geriatric Kindle.]

The problem with ‘get object properties’ is that it only gets you a list of the top level properties. If you have a complicated data structure, you’re throwing out most of the data when you do that. I think you’re only going to get item numbers for the ‘rows’ object, since it is an array.

Alerts aren’t supposed to take objects. They take text strings. So I’m not sure if the different behavior there is useful/informative.

@catsarisky many thanks for your message. I think I’ll try to make my Airtable a bit less heavy - there are actually 2 or 3 columns I don’t need (out of 15) - I’ll try to make this amendment tomorrow and get back with an update.

In addition, just wanted to clarify that I used the alert only to see if the object were retrieved. It’s clear I can’t use them as object considering that alert is supposed to be text (I would say it’s the same reasoning of the vibrate block :wink:).

At this point I think the issue is due to the quantity of data I am trying to retrieve - not so good! The problem doesn’t happen on iPhone XS so there should be a reason for that.

1 Like

Rather than deleting columns, why not make a new airtable view with some columns hidden and get just that view? You could also filter, if you don’t actually need to retrieve all 3000 records.

1 Like

I would say this is a phone’s memory issue rather than application or coding. Check the available memory in your S9 device and you would find that you do not have enough to hold all 3000 records with 15 columns each.

If you are planning to publish this app then you might want to retrieve every 1000 records at a time and save them to a different stored variable to cater for old phones or low memory devices.

1 Like

@muneer many thanks for your response. I have available 23GB in my Samsung S9 - I am not sure it’s an memory storage issue. Instead, could that be related to the RAM available? Samsung S9 has 4GB of RAM but available I only have 1.2GB. Could this be the case in your opinion?

I also tried to create a list of sublist as the screenshot below but I couldn’t make it work - do you have any suggestions? How we can merge list of objectives?
Capture4

1 Like

I think muneer was suggesting a different stored variable for each part of the list. The proposed blocks above do not make the stored variable any smaller.

You’re creating nested lists with the above. That’s probably not what you intended. Unfortunately there’s no block that splices two lists together. You could loop through the second list and add the second list’s items items to the end of the first list one at a time. I don’t see the benefit of doing so, however. You’re just undoing your work of splitting them in the first place.

1 Like

I was referring to the memory (RAM) not the storage space.

Splitting of the rows idea was presented to give support to old devices and you need to weigh the benefits of such idea and the complexity of the coding to implement it.

One way is to get list of values for the column “ID”. You will have a list that has all row IDs and you can get the number of entries in this list and split it in a number of variables. For example, every 1000 rows to be saved in a separate stored variable. This also means you will have to loop through the rows to save them in the stored variables sequentially.

@catsarisky @muneer
I have actually a good news! I downloaded the app in my Android device and it seems working now - hence it’s a problem of the Thunkable app. I am really happy it’s working now.

However, I have also noticed that if I retrieve the data from Airtable, then change screen, and then:

  1. if I start and fire a timer (every 2 seconds) to see if the app var is fulfilled it takes around 25 seconds to get the data ready to use
  2. If I don’t start the timer it takes only 14 seconds to retrieve all data and be able to use them.

Screenshot below:
Capture5

Do you have any solutions? Or any suggestions on how to reach the same result without the timer?

P.S. I have another timer firing every 8 seconds to check another parameter but this don’t affect the timing of getting the data

1 Like

Good news. This is definitely a memory (RAM) issue.

The blocks are too small to read but I see that they are not alike and they refer to functions that are not part of the screen copy. It would be very difficult to comment on “black box” functions.