Help with Formula syntax using Filter and multiple columns

Hi Coda community! Still learning the syntax of formula writing in Coda.

I’m trying to write a formula on blank canvas that I want to return a filtered list of the table Wine Database that returns the Producer, Denom, and Wine Named for all rows where 86’d is checked.

Here’s a screen shot of the table and columns in use

Here’s a screen shot of the formula as far as I can figure it out

What it should output is:

  • Sangouard-Guyot Pouilly-Fuissé “Terroirs”
  • Domaine Romain Collet Chablis “Les Pargues”

Thanks in advance for your help in understanding.
Jeff

Hi @Jeff_Fleming,

You could have a look at the FormulaMap() formula.

Your code could be something like:
[Wines Database].Filter(86'd).FormulaMap(Format("{1} - {2}",@CurrentValue.Producer, @CurrentValue.Denom)).BulletedList().

Note:
As you can see, in a checkbox field it’s not necessary to explicitly set equality to boolean.

Let me know if it helps.
Cheers!

1 Like

That works! But I’m still scratching my head as to why FormulaMap? And what’s Format?

Is there a way to include one of the columns results within quotation marks, as in:

Sangouard-Guyot Pouilly-Fuissé “Terroirs”

from the example above, if the contents of Wine Named is Terroirs.

Thanks for the help!

Hi @Jeff_Fleming,
happy it works!

Coming to your questions:

FormulaMap() processes sequentially all the elements of an array.
Therefore
[Table].Filter(condition) (in your case [Wines Database].Filter(86'd))
returns a list of rows. With FormulaMap() you take one row at a time (the @CurrentValue variable) and you can access all the columns of that row.

Format() function allows you to - well - format text along with variables. Number in curly braces are the placeholders of variables, sequentially. So you are able to format the sting and “fill” it with the variables at each iteration.

Sure, just “escape” the quotes with the backslash (\).
Hence:
Format("This is my \"quoted\" text") or
Format("This is my \"{1}\"", [quoted-variable])

:bulb:
I warmly suggest you to spend some time reading the Coda Formula’s Reference.

Anyway, feel free to ask whenever needed.

4 Likes

Thank you, @Federico_Stefanato! That makes so much sense now. Learning so much here. Your plain language explanations make more sense to me. I’ve been using the Coda Formula’s Reference but I don’t always find their usage examples applicable or helpful in figuring out the formula for a newbie such as me.

Where could I find a list of the syntax used within formulas? For instance, where would I have learned about “escape” the quotes with the backslash ( \ )?

In Coda’s Help, I would have expected to find that here in the article on Writing in Coda’s formula language. But the list is rather scant.

Hi @Jeff_Fleming,
Yes, you are right…
The Formula Reference could be improved a lot and I’m sure it’s one the things @Codans are thinking about.

My background is software engineering, so I’m helped by similarities among different coding languages.

However, just put your hands on and you’ll see you’ll master Coda in few weeks.
Meanwhile, you can rely on this community that is always helpful and responsive.

Let me know if you need anything else.
Cheers!