[Solved] Retrieve data from Airtable based on condition

Hi,

in your solution you copied the rows from the DB to the list “filterList” in the local memory of the app. how do you initialized that local list?

I usually initialize the list with an empty block [empty list]

how to determine the number and the type of the columns?

To determine the number of columns, you can, for example, check for the existence of a data column or make the last column empty. In the loop, increase the column count until you encounter a column named * (for example).

Another way is to count the number of columns using the row of the first record, for example. The fields in the row are separated from each other and you can calculate the number of fields in the record based on this feature.

About the type of columns. Here you can do a type check, for example, if when you try to perform a mathematical operation, you get the value nan, then the column type is not exactly a number. If the data field contains the string “http or https”, then this is a link, and if an extension .jpg or .gif-link to the image. I think you understand the idea of defining a type.

what if i manage my DB in airtable and i store pictures there, can this script copy those pictures to the local table?

Local DB can only store text (if the developers haven’t changed anything since then). For this reason, you can store either text links to images in Local DB, or the images themselves in base64 text format. There are online generators that can take a link to an image and then return you to a WebAPI file in base64 format. My demo app should have such an example. Foxtools.ru he knows how to do it.

as i understand, instead of insert hardcoded email address, with the sign in we can store the email of the user in global variable and use that variable in order to retrieve the relevant data?

Yes, it is better to store data in Firebase, and then after a successful user login, you can save his login parameters locally in the stored variable, so that when the application is opened later, he does not enter them again each time. And to use data on different screens, you can use global app variables, as you write.

2 Likes

Hi. Thanks a lot. But why did we need local storage exactly??? Please explain. It would be a great help.