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 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.
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.
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.
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.
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.