Apr 28, 2022 02:22 AM
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!
Apr 28, 2022 02:31 AM
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!)
Apr 28, 2022 02:38 AM
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
Apr 28, 2022 03:04 AM
Ah, I see. Apologies, I thought you were using the REST API, and so would need to use the previously mentioned syntax
May 04, 2022 06:49 AM
@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!