New Feature: Tablets (and Reusable Formulas!)

Tables are core to what makes Coda powerful and flexible, and by using formulas in your tables you can automate many calculations.

Until today, it’s been hard for Coda builders to make tables using formulas. With Tablets, it’s now easy.

Making Tables with Formulas

For example, you can make this tablet:

With this formula:

Tablet(My Table, Size, Class, 
  Sequence(1, 5).ForEach(CurrentValue.WithName(Number,
    List("A", "B", "C").ForEach(CurrentValue.WithName(Letter,
      Entry(Number, Letter)
    ))
  ))
)

There are two new formula names to learn here:

  1. Tablet this is what makes the tablet and gives the columns their names
  2. Entry this is where you put the list of your entries for your tablet

Notice that all you needed to do was give the Tablet a name, My Table, as well as the column names Size and Class and it’s automatically turned into a table.

The tablet is read only, once it’s created you can’t edit the entries, they’re set in stone. If you want to change what they show you’ll either need to edit the formula or change the underlying data. That’s why they’re called Tablets: they’re little tables and there’s no eraser once they’re carved:

Use it Just Like WithName

Just as WithName allowed you to give a name to a value, Tablets allow you to name lists of values (in fact, under the hood, Entry is just another name for List!).

But you can do all the other things you love to do with tables, like copy and pasting and creating views, as well as…

Writing Reusable Formulas

Many of you have asked for reusable formulas. While you can use Packs for this, we’ve heard they can be a bit slow and aren’t as intuitive as just writing the formula in Coda’s formula language.

With tablets, you can now write reusable formulas in Coda’s native language!

Reusable(My Table, Display Name,
  Concatenate(Size, Class),
  [Display Name](My Table.Filter(Size = 1))
)

image

Just like adding a column to a table, all you have to do is:

  1. say which tablet or table it uses (My Table, the one we created before)
  2. give the reusable formula a name (Display Name)
  3. define the formula, using the columns of the tablet Concatenate(Size, Class)
  4. call the formula somewhere in the body of Reusable ([Display Name](...))

It’s just like WithName for formulas, it allows you to write a complex formula once and then reuse it multiple times in the body of a button or formula. (Would you like to be able to export it to other formulas? Let us know!)

How it used to be

It used to be that the only way to approximate this, you would have had to return a list of lists.
image

Working with these lists of lists was extremely inconvenient:

  1. you have to use Nth to get the value, meaning you also have to remember the index of the value
  2. if there was a reference to another table in the list, you’d have to use filter to be able to access the attributes of the row

A Powerful Debugging Tool

We’ve seen how you debug your complex formulas by returning a list of the arguments one at a time.

Well now this is supported directly by giving them pretty formatting and filtering!

How to use this?

Looking for some great inspiration for how other Coda makers have used Tablets [ok fine, lists of lists] to make great things?
See:

Max has found a hack way to implement this

1 Like