Coalesce Function

It’d be great to have a coalesce function for when we’re doing operations across multiple columns that we expect to have null (empty) values.

Isn’t .IfBlank() what you need?

Example: Users.Filter(...).Address.IfBlank("No address")

No, I’m looking to coalesce across columns for a given row, so it’d be more like:

thisRow.col1 = null
thisRow.col2 = 2
thisRow.col3 = 3

coalesce(thisRow.col1,thisRow.col2,thisRow.col3) = 2

Which yes, I can do with a list, filter, and array element select, but given that coalesce is a pretty standard database function it makes sense to create that function directly.

You can write that like col1.ifBlank(col2).ifBlank(col3) and so on.

Alternatively, you can do something like List(col1, col2, col3).Filter(CurrentValue).First(), but that is less performant.

Of course, in either case you’ll need to specify columns explicitly, you can’t just feed a horizontal range of cells in Coda.

1 Like

@Christian_Rodriguez1 could you please describe schema (columns structure) of your table? my personal belief is if adding values across many columns is a side effect of not-normalizing data (i.e breaking data in two separate tables and linking them via lookups) so collecting cases where there is a genuine need of formula to work across multiple columns.