Rendering a list of Buttons from a formula

Hey all,

At its core I’m attempting to render a list of buttons from a formula given some list. Right now, I have a table with a column of type button, and elsewhere on the page I want to render those buttons on the page through a formula.

I’ve iterated through different formulas, looked into the hidden Button() function but haven’t been able to find a solution

Here’s what I expect to work:

[Table].FormulaMap(CurrentValue.ButtonColumn)

All this gets me is a comma separated list of ⚡️ Action.

I’m starting to think that this isn’t possible, currently, on Coda.

Has anyone found a solution for this?

1 Like

Hey Matt, welcome to the Community!

The hidden Button() formula to the rescue but you have to use it in a separate column on your table, then concatenate the values from that column.

  1. In your table, set up your button (let it be a column called ButtonColumn)
  2. Add a column of default Text type (let it be called ButtonFormulaColumn) and make it a formula:
    Button(thisRow.ButtonColumn, "My Label")
    
  3. Now in your page or anywhere in the doc, do the:
    Table.ButtonFormulaColumn.Concatenate()
    

to render those buttons inline.

To add spaces between buttons, add .Concatenate(" ")to the Button() formula on step 2. You can also try adding .Trim() to the formula on the step 3 to eliminate the trailing space but I’m not sure from my memory whether that will work. Using Join(" ") instead of these may not work.

3 Likes

@Paul_Danyliuk This worked like a charm, thank you!

Really curious as to why this extra column w/ the .Concatenate() call is needed. As opposed to, just on the page, Table.ButtonColumn.FormulaMap(Button(CurrentValue.ButtonColumn,"my label").Concatenate())

Hello @Matt_Albrecht!
I made a template that helps a lot in these cases

2 Likes

Oh this is super helpful, I’ve been going into devtools to find the name of these icons. Thanks @Saul_Garcia

1 Like

Super nice! Thx :wink:

-L

1 Like

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