Welcome to the Airtable community!
It sounds like you are familiar with databases, SQL, and JavaScript/Node. However, Airtable is slightly different from other relational databases. You cannot query Airtable with SQL.
Since you say that you are using node.js, you must be using the Standard REST API. The “List Records” section of the documentation at api.airtable.com provides an example for how to use filterByFormula
.
When using filterByFormula
I recommend you first create a formula field in your base that yields the results you want. Then you can copy the formula for the formula field exactly. The formula field reference has more information on creating formulas.
In your case the formula would probably be something like
IF({col_2} = value, 'include me')
Welcome to the Airtable community!
It sounds like you are familiar with databases, SQL, and JavaScript/Node. However, Airtable is slightly different from other relational databases. You cannot query Airtable with SQL.
Since you say that you are using node.js, you must be using the Standard REST API. The “List Records” section of the documentation at api.airtable.com provides an example for how to use filterByFormula
.
When using filterByFormula
I recommend you first create a formula field in your base that yields the results you want. Then you can copy the formula for the formula field exactly. The formula field reference has more information on creating formulas.
In your case the formula would probably be something like
IF({col_2} = value, 'include me')
Thanks a lot, kuovon.
Your message is very helpful.
Welcome to the Airtable community!
It sounds like you are familiar with databases, SQL, and JavaScript/Node. However, Airtable is slightly different from other relational databases. You cannot query Airtable with SQL.
Since you say that you are using node.js, you must be using the Standard REST API. The “List Records” section of the documentation at api.airtable.com provides an example for how to use filterByFormula
.
When using filterByFormula
I recommend you first create a formula field in your base that yields the results you want. Then you can copy the formula for the formula field exactly. The formula field reference has more information on creating formulas.
In your case the formula would probably be something like
IF({col_2} = value, 'include me')
Very sorry that I mistyped your handler in the previous reply, Kuovonne.
For example, there are two fields col_1 and col_2, and a parameter p1
let p1 = req.body.queryResult.parameters.par1
It is assumed that there is a field named col_1.
How to write the code for filterByFormula if I want to find all the records that col_1 == p1
filterByFormula: …?
Thanks so much for any help.
Very sorry that I mistyped your handler in the previous reply, Kuovonne.
For example, there are two fields col_1 and col_2, and a parameter p1
let p1 = req.body.queryResult.parameters.par1
It is assumed that there is a field named col_1.
How to write the code for filterByFormula if I want to find all the records that col_1 == p1
filterByFormula: …?
Thanks so much for any help.
I found this: filterByFormula: ‘{col_1} = “p1”’
Already tested it and it works.
Thanks so much for any help.