Help

Two values out of 1 column

Topic Labels: Formulas
Solved
Jump to Solution
1937 5
cancel
Showing results for 
Search instead for 
Did you mean: 
Max_airt
4 - Data Explorer
4 - Data Explorer

Hi everybody,

I am new to using Airtable.

I am sure that there is a formula for this but I can’t seem to find it or I don’t write it in a correct way.

With a API service of a third party software I pull data from my Airtable. This data is dynamically filtered by using filterByFormula. The data I need is in the column called “groupcode” and has numeric values varying from 100 and 900. These numbers stand for product categories.

Normally if I need products from the category with the number 212 I use the following formula.

{groupcode"} =“212”

But now I need products from category 212 and 268. Is there a way I can display only the records of two different specifc values ?

Any suggestions or tips are appreciated!

Thank you in advance!

1 Solution

Accepted Solutions

Basically, you would just need to think about what sort of a formula you would write in Airtable which would result in 1 (which is “true”).

In your circumstance, you would use the OR function with your filterByFormula query.

So, if you were just using the Airtable interface itself, your OR formula within Airtable would look like this:

OR({groupcode}="212",{groupcode}="268")

So if you’re using JavaScript to access the API, your filterByFormula query would look like this:

filterByFormula: "OR({groupcode}="212",{groupcode}="268")"

If you’re using cURL to access the API, you would need to URL encode your OR formula like this:

OR(%7Bgroupcode%7D%3D%22212%22%2C%7Bgroupcode%7D%3D%22268%22)

(Although whatever 3rd-party software you’re using might automatically URL encode it for you, so you might not need to worry about this part of it.)

Hope this helps! If this answers your question, could you please mark this comment as the solution to your question? This will help other people who have a similar question. :slightly_smiling_face:

See Solution in Thread

5 Replies 5

Go to airtable.com/api and it will show you how to properly construct your API call for the “list records” GET request. It’s pretty awesome because it will give you actual examples based on your own base.

Thank you for the reply, I looked at this API doucmentation but I only see that I can display two values out of two different columns and I would like to display two specific values from one column.

Am I missing something?

Basically, you would just need to think about what sort of a formula you would write in Airtable which would result in 1 (which is “true”).

In your circumstance, you would use the OR function with your filterByFormula query.

So, if you were just using the Airtable interface itself, your OR formula within Airtable would look like this:

OR({groupcode}="212",{groupcode}="268")

So if you’re using JavaScript to access the API, your filterByFormula query would look like this:

filterByFormula: "OR({groupcode}="212",{groupcode}="268")"

If you’re using cURL to access the API, you would need to URL encode your OR formula like this:

OR(%7Bgroupcode%7D%3D%22212%22%2C%7Bgroupcode%7D%3D%22268%22)

(Although whatever 3rd-party software you’re using might automatically URL encode it for you, so you might not need to worry about this part of it.)

Hope this helps! If this answers your question, could you please mark this comment as the solution to your question? This will help other people who have a similar question. :slightly_smiling_face:

Max_airt
4 - Data Explorer
4 - Data Explorer

** This definitely helps, thank you very much. I had the wrong approach for the formula I now see. I was focused on using the AND statement for the formula and didn’t think of using OR.

Thanks! **

You’re welcome! Also, you marked the wrong comment as the solution. Please mark my comment above as the solution. Thanks! :slightly_smiling_face: