Launched: Formula Tables Pack — Make Tables out of Formulas! 🤯

Okay, this is HUGE!

Every once in a while, a revolutionary product comes along that changes everything and Apple has been… uh oh, wrong speech :sweat_smile:

With no lesser bravado, let me present to you…
 

Yes, this is a pack that allows you to create tables dynamically
with a List-of-Lists formula!

Think of all you can do with it:

  • set up transposed views such as your P&L’s with months as columns — as easy as this:

  • combine multiple tables into a single view like all synced in Tasks and Calendars — like Notion and Clickup already can!

  • Render any custom report e.g. to copy-paste into Sheets — like this one with “fake groups”:

  • and everything else that your formula skills can let you do!
     

The Video:

:information_source:   The guide doc is also coming soon!

 
Cheers,
Paul

22 Likes

This awesome Paul! Thank you! I have a situation similar to combining multiple tables into one.

However, my syntax/formula isn’t quite right (each row in the formula table is a list of rows from each individual table I’m combining). Can you show the formula you used for the calendar example?

Thanks!

Sure. Here’s the formula. You have to combine the lists of values there:

List(
  List().Splice(0, 0, [Synced Tasks].Task, [Local Tasks].Task),
  List().Splice(0, 0, [Synced Tasks].Due, [Local Tasks].[Due date])
).WithName(M, Object("data", M.Splice(0, 0, "")))

And the orientation is Columns, of course.

I’m going to record a video on this pack now and release it tomorrow; I’ll go in greater detail how to go about it all. The next thing you can and should do is mix in references to actual rows from either table so that you can display them in the detail layout for the formula table.

3 Likes

Works great now. Thanks Paul. Can’t wait to see the video.

After playing around some, I was able to pull in the “buttons” from the individual tables (at the least the action) and create a main button column in the formula table that referenced the Action of each row. When clicked on in the formula table, I was able to update the individual tables (wish I could upload the video).

Basically, each button in the formula table can be customized instead of all one formula. I can see a way to create and manage a master button table. Pretty cool.

2 Likes

There are Coda Prodigies, Coda Ninjas, Coda Alchemists, Coda Gods, and there’s @Paul_Danyliuk
I can see so many use cases for this! Thanks again for sharing your genius!

3 Likes

Haha thanks! :sweat_smile: curious to hear all your ideas, maybe I’ll make them the basis of some of my videos!

2 Likes

Transpose and combine are by themselves killers.

But also the ability to create calculated summary tables like a Pivot with the actual summary fields being the values of the cells (I was using buttons to identify unique values of a field in source table with automations to AddorModify entries in a summary table that would then calculate the aggregates/summary fields). E.g.:
If this is your source table:
image
Now you can with a formula create tables that tell you:

  • Who likes each fruit(s)?
  • How many people like each fruit?
  • Do we have double entries (2 rows with same person liking same fruit)?

You can use Group by, but you wouldn’t have the answers in a table that then you can then use (you could still get everything through formulas, but sometimes you want the summary table)

2 Likes

Oh yeah, that too! Thanks!

And also the opposite — expanding tables that have multi-relations (like, [Monica, Phoebe] → Oranges) into separate rows so that we can group on them, make charts etc. A very common need too!

1 Like

Transforming tables from “canonical form” to and from “transposed form” through a simple formula is indeed a VERY convenient feature to have, especially when you want to display data on a graphic (canonical is generally better) or on an easy to read table (transposed is generally better).

1 Like

The video is now finally up! Descript decided to never render me this one :slight_smile:

7 Likes

Paul - this is stunning in the capability it adds to Coda. Extremely well done.

One small question - does the “M” in your “special formula” refer to “Matrix”? Where is this documented in the Coda documentation?

Thank you.

M stands for Matrix but only because I named it so. It does not have any special meaning in Coda and therefore it doesn’t matter how you name it; it’s just a variable that you reuse on the next line of the code.

This whole snippet only exists to make setup a little bit easier — you just append that bit to the end of your List(...) formula. You could totally not use the WithName and instead wrap your

List(...)

like

Object(
  "data",
  List(...).Splice(0, 0, "")
)

or even ditch the inobvious Splice and write it explicitly like

Object(
  "data",
  List(
    "",             // because it only matters that there is at least
    List(...),      // one non-list element in the outer list,
    List(...),      // otherwise Coda ListCombine()s those for some reason
    ...
  )
)

but it’s much easier to just add one predefined snippet to a formula rather than explain what to write before and what to write after :wink:

BTW, take this hint for writing formulas in general — I love to chain WithName blocks onto the existing transformation chain to make it obvious that it’s the next transformation block. With simply wrapping formulas in formulas, it does not look that obvious.

Thank you Paul - that is a great explanation.

One more question if I may - how can I get a Formula Table to render HTML?

This is my input:

I get this but would prefer to get bolded output

My pack doesn’t do any conversions — you have to supply an already formatted text value to it. So you’ll need another pack to convert HTML into formatted text, e.g. this one.

In your case though, if you just want a bolded output, you can use a hidden _Bold() formula onto the value, e.g. _Bold("This is a test with bold"), and pass that to the formula table. Or if you’re not a fan of hidden formulas, alternatively use the Format()-with-templates method like in this tip: just make yourself a template of a bold {1}. Both these methods would save you the trouble of using a separate pack and the processing delays caused by another round trip to coda servers.

Lastly, if you only need it to be bold for display, you can use conditional formatting. Just reminding you that you can use a formula like thisRow = @AtReferenceToASpecificRow to select an exact row to apply cond formatting to.

Thanks Paul. I solved that.

I have a separate issue which I suspect is somewhat of a one-off case since it involves retrieving data from an XML API converted to JSON objects.

The data displays like this as output from my pack:

But when I try to depict it in a table it not putting the data properly into individual rows:

These are the Formula Table Pack settings:

Any thoughts?

If this is enough to help I would appreciate it. If not see my private message asking for more direct help. I know this is really close to working but I am not sure if I am not parsing the data correctly or if there is some artifact in the way the data is coming out of the pack.

You can work with that actually. I’m not sure why you aren’t just getting your sync table already formatted out of that XML data (i.e. why you even need my pack), but let’s assume you have good reasons to use it.

What you’re doing wrong is wrapping what’s already lists of PMID, Title, DOI etc into yet another lists. That’s why you’re getting lists within cells.

If you want to render a table where the first row reads PMID and then each row in that column is one individual PMD, then the same for Title, Abstract etc (so that it’s not a transposed table but a regular table), the formula should be:

List(
  List("PMID").Splice(2, 0, PM.PMID),
  List("Title").Splice(2, 0, PM.Title),
  List("Abstract").Splice(2, 0, PM.Abstract),
  List("DOI").Splice(2, 0, PM.DOI)
).WithName(...)

i.e. you’re making lists where the first element is the column title, and then you append the list of values from each respective column of your PM table. Then render those as columns.

That works perfectly Paul! Huge thanks.

FYI took a look at your doc; since it’s your pack, you should rather just implement a Sync Table out of your data. That way you’d import the data as a table directly and won’t need my pack to render it.

The sync table is an interesting suggestion @Paul_Danyliuk

I have used that in a different part of my project

The biggest challenge is that the table I shared has regularly changing query parameters which are part of the main front end UI of the Coda page

If I set this up as a sync table am I correct that the only way to change query parameters is in the side panel of the sync table? Is there any way for the sync table query parameter to be a main part of the Coda page?

1 Like