Help

This Product Ideas board is currently undergoing updates, but please continue to submit your ideas.

Suggestion for new Logical Operator: "IN"

cancel
Showing results for 
Search instead for 
Did you mean: 
John_Zimmerman
5 - Automation Enthusiast
5 - Automation Enthusiast

Greeting from beautiful Austin, Texas!

I’d like to suggest a new logical operator, “IN”. It would return true if any value matched the field.

It would look something like this:
IN({myTestField}, “text1”, "text2,…)
or
IN({myIntegerField}, 2001, 2002, 2003…)

This logical operation can currently be implemented with OR(), but can get pretty long if there are a lot of options.

Thanks!

4 Comments
Bill_French
17 - Neptune
17 - Neptune

That could get you into trouble. Isn’t 2001 in 22,002,001?

John_Zimmerman
5 - Automation Enthusiast
5 - Automation Enthusiast

Hey, Bill. I would assume that the underlying software would look at the field type. For text fields (like single select) it would have to match the entire field.

For example, if( IN({myTextField}, “apples”, “pears”), “fruit”, “not fruit”)
would be equivalent to
IF( OR({myTextField}=“apples”, {myTextField}=“pears”), “fruit”, “not fruit”)

You can see how the OR could get pretty long.

Bill_French
17 - Neptune
17 - Neptune

@John_Zimmerman,

I suspected that’s what you may have had in mind, but the term “IN” suggests something very different than “EQ” or “CONTAINS”, or IndexOf().

I get it though - you want a more elegant way of knowing if a value is in a list of possible values. This has a good deal of relevance to array handling which is non-existent in Airtable.

In JavaScript, for example, IndexOf() returns the location in the array (string or list). If it doesn’t exist, it returns -1. In my view, to do this elegantly for both strings and numbers, we need array support. Without arrays, anywhere you go with this idea can get into the weeds semantically.

If Airtable adopts “IN” can we all agree that it’s synonymous with IndexOf()? :winking_face:

Jeremy_Oglesby
14 - Jupiter
14 - Jupiter

I have a generalized #product-suggestions post for new formula functions here:

where I address a couple other array-related functions that would be nice to have as well. An IN(value, array) function could be added as a reply to that post as well, if you felt like centralizing it with these other functions requested.