[Solved] Get cell value from other column

Hi Guy,

how to get cell base on specific value from other column in airtable?
for example from screen shoot below. when i click on button register base from column status it will list all relevant value from column number. I have check from forum but nothing similar.

First let me acknowledge I’ve only been working with Thunkable for a little over a month. And I’m not a coder, so this solution is one I’ve worked out myself by experimenting.
I have a similar need to find a value in a column in Airtable, and then get the value from the same row in a different column. I also need to get the entire row.
My solution looks like this:

  • download the whole sheet from Airtable into a variable
  • create a list for the column that contains the value you want to find
  • create a list for the column that contains the value you want to get
    To create these lists I did this:
  • make two empty list variables (to hold the two columns of data) - eg NumberList and StatusList
  • get the list of properties of the downloaded object (in my case a list running from 0 to (last row no minus 1)), each of these properties is an object that contains a row from the sheet. Store this list in another variable (eg PropertyList)
  • using the name of the find-in column “Status”, in each row get the property “Status” and add it (as last) to the list StatusList
  • using the name of the get column “Number”, in each row get the property “Number” and add it (as last) to the list NumberList
  • I also find it useful to look up a third property “_id” which returns the unique Airtable record id for the line in the database. I store this in a variable called, for example, Rec_idList.
    You can then search the status list, return an index that matches the value you want to find, and then use the index to find the matching value in the other list. Your situation is different to mine in that I’m searching for a unique value in a list, yours repeat so you’ll need to adapt this method to allow for that.
    Note also that empty cells can cause this method to fail, so if there might be empty cells you’ll need to protect against that - by checking if a property exists before adding it to the list, and if it doesn’t writing “no value” for example to the list. Your two lists have to be the same length and in their original order for this approach to work - if you sort one this method will fail. Hope this helps. Here are some examples from my project:
    This is the main block where the lists are set to empty, the data sheet is downloaded, and the lists are created using my ListOneProperty function -

    This is my ListOneProperty function -

    This is my GetMyProfile function, which essentially finds a line in the the data sheet by searching for an entry in one column, and then saves properties from that line to specific variables -

There are many more steps to this than I imagined I’d need!
A webAPI data query would possibly be simpler but I don’t know how to do that.
Also Airtable limits calls to the database to 5 per second, which is why I went with downloading the whole sheet and manipulating that data in the app.

2 Likes

Use Airtable REST API. Sample in scrAirTableRestAPI on https://x.thunkable.com/projects/5d70f93f8a62b4079eedaff2/project/properties/designer/

3 Likes

Hi @actech, I’ve had a look at the project you linked to. Can you point me to a beginners guide to constructing a query like that? Thanks.

I think it will be more convenient for you to study the official use of the REST API. In the AirTable control panel, you can open your table and you will immediately be given sample queries for your table.

In the window that opens, you will need to find a section on how to make queries and filter entries

2 Likes

Thanks @actech, I’ll play with that.
A related query (and then I’ll leave you alone!) - do you know if the Airtable limit on queries (5 per second) is per user or per table? If per table, then as the number of users of an app increases the limit could be quickly reached. But if it’s per user then the number of calls can be controlled within the app.

Rate Limits

The API is limited to 5 requests per second per base. If you exceed this rate, you will receive a 429 status code and will need to wait 30 seconds before subsequent requests will succeed.

1 Like

Thanks. So that would mean that too many users accessing the base (ie using the app) would trigger a 429 status. Good to know.

using normal block not possible to get value i want?

You can also use blocks to get the value you need. To do this, you need to get all the records from AirTable and use the IF block in the loop to select the necessary records.

Basic sample

изображение

and to using rest api it more suitable?
and how possible result will display at list view.?

The REST API is more convenient and functional.

I already gave an example of the REST API above in this topic

base on formula given, will only select Olaf from column Name?
filterByFormula=({Name} = ‘Olaf’)&fields[]=Name

and i saw in document also we can use api encoder.

You are asking a question that I expect you to answer. If you use this query you have that is displayed on the screen?

this query from your page “filterByFormula=({Name} = ‘Olaf’)&fields=Name” that why i am asking and result i got something i am not understand.

1 Like

When you request data this way, you get back data in JSON format. You need to parse this data using the object blocks.

Nice work using the api. That’s a little more advanced but gets you what you need!

1 Like

I don’t know where you got your data from. I run my example in Bluestacks and see a working example that outputs a single entry-Olaf

изображение

i try to manipulate your block but i got undefined as result. can you advise what is screen shoot below coming from?


record?
Name?
fields?

hi
i try to manipulate your block but i got undefined as result. can you advise what is screen shoot below coming from?


record?
Name?
fields?

1 Like