Help

Re: Filterbyformnula python Airtable API

1825 2
cancel
Showing results for 
Search instead for 
Did you mean: 
Wenjia_Qian
4 - Data Explorer
4 - Data Explorer

Hello people,

I’m really new to all this, so this might be a stupid question.
I want to retrieve AirTable data from my table, filtered by two variables (problem, severity). Based on these two values, the code should give back individual help offerings. But it seems that I can only filter by one variable using “filterbyformula”. Using two it gives back that the request is invalid. Is my syntax just wrong or is it even possible to filter by two variables?

data = {
  "filterByFormula": [f"problem = '{mood}'", f"severity = '{severity}'"],
  "fields": ["help"] 
}

thank you so much!

4 Replies 4

Hmm, I think you have to use Airtable’s formula syntax for that, so you’d end have to use an AND()

And so something like AND(f"problem = '{mood}'", f"severity='{severity}'")?

(I’m not familiar with python at all, and think I am probably butchering your code horribly, but you get the idea!)

Hey,

thanks for your answer! Unfortunally it does not work with the AirTable formula syntax within python (at least as far as I know).

Best regards

Ah, I see. Apologies, I thought you were using the REST API, and so would need to use the previously mentioned syntax

GavinA
8 - Airtable Astronomer
8 - Airtable Astronomer

@Wenjia_Qian you may be able to do this with www.csvgetter.com. You can make a csv endpoint and then use the filter paramter to pipe your filtered data straight into python using pandas or something!