ContainsOnly() does not function as it should

The “ContainsOnly(value, search)” function doesn’t work as it should. I get what you were trying to do, but it doesn’t make much logical sense - it uses AND instead of OR.

It says:
“Outputs True if only values in search exist in value.”

So, what should it’s output be for this example?
List(“Dog”, “Mouse”).ContainsOnly(“Cat”, “Mouse”, “Dog”)
According to the formal description for it, all values in the list exist in the search–so, it should return True.

And this one?
List(“Dog”, “Mouse”, “Cat”).ContainsOnly(“Mouse”, “Dog”)
This should return False as not only values in the search exist in the value.

But that’s not how it works… Currently, it only will return True when all values in the list are contained at least once within the search and all values in the search are contained at least once within the value This isn’t practically useful at all…

By the way, Coda already recognizes that I’m right syntactically, they built this logic into their filtering function:

If you add a filter to a table for a ‘Select Multiple’ column, it gives you six options, the first 4 are for logical (and/or type) groupings, the last 2 cover unique scenarios:

  • contains all of (and function)
  • contains any of (or function)
  • is exactly (and function)
  • does not contain (or function) this is the same as a ‘ContainsOnly().Not()’ function in theory
  • blank/not blank
  • count of

If there’s a strong reason for it functioning this way, then:

  • Its function name should be changed to match it’s description,
    OR
  • Its description should be updated for what it actually means and then another function should be added called something like “IsSubsetOf” or something.

For any who find themselves looking for how to achieve what ContainsOnly() should achieve, use this formula:
value=(value.Filter(value.contains(search)))