Filter Help - Lookup with Condition

Hello!

I’m having a hard time with the filter syntax. My guess is what I need is simple but I don’t know the “language” enough to know what I’m doing wrong. I’m trying to reference a row for “unfilled orders”. Here’s the test doc (“Filter View Unfilled Orders” subpage):

The last row on the bottom (titled “Unfilled Orders”) has a formula problem. My formula is:
[Pending Orders and Requests].Filter([Ordered By].Contains(thisRow)And(Delivered=false))

Without the “And . . .” section the formula works just fine, but I’m clearly formatting it correctly (or just going about it the wrong way). I’m awfully confident this is something Coda can do.

Hey there!

I think you just had some problems with specifically writing the and part

image

You could also just place a “.” before the And() function and it should work
image
But i believe that Coda recommends the first example/screenshot

1 Like

Thanks!! Ok, so I didn’t need parentheses around the Delivered=false part (in the first example)?

Yeah - You can use the actual and() formula in Coda (See below)
image

But I just prefer writing in and / or directly

1 Like

You can but you shouldn’t

1 Like

why? I use it quite often …

Those functions are there for the sole purpose: to be familiar for Excel/Sheets users. They are not optimized, i.e. they won’t short-circuit if earlier conditions are enough to determine the result.

See the similar thing explained here:

I.e.,

BigTable.Filter(
  Date >= Today()
  AND SomeComplicatedConditional1
  AND SomeComplicatedConditional2
  AND SomeComplicatedConditional3
)

would stop at checking the date if it’s in the past and never test the other three conditions — it’s already known that the result of the whole expression is false.

Whereas

BigTable.Filter(
  And(
    Date >= Today(),
    SomeComplicatedConditional1,
    SomeComplicatedConditional2,
    SomeComplicatedConditional3
  )
)

would calculate all four conditions every time because that’s how functions work — first the arguments are evaluated and then the function gets the results of each argument’s resulting value.

P.S. The official docs say it as well:

6 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.