Defining options for custom column

I’ve created my own formula and a column using said formula.
How do I define the options for the column? Like the Progress column does:

Hello @Rickard_Abraham ,

There are two ways of doing that.

  1. use a progress column and add your formula to that column. In the sample below the formula in progress is a very simple = amount (don’t type the “=”).

image

The other solution is to right click on the column with the formula and add a conditional format. Your column has to be a numeric type column for color scape options:

Greetings, Joost

1 Like

Thank you for that thorough answer but I’m sorry that’s not what I meant :frowning:

I have this code for my pack:

import * as coda from "@codahq/packs-sdk";

export const pack = coda.newPack();

pack.addFormula({
  name: "MyFormula",

  description: "My description",
  parameters: [
    coda.makeParameter({
      type: coda.ParameterType.Date,
      name: "X",
      description: "",
    }),

    coda.makeParameter({
      type: coda.ParameterType.Number,
      name: "Y",
      description: "",
      optional: true,
      suggestedValue: 1,
    })
  ],
  
  resultType: coda.ValueType.String,

  execute: async function ([X, Y], context) {
    return "hi " + X + " " + Y;
  },
});

pack.addColumnFormat({
  name: "MyColumn",
  instructions: "Instructions for my column.",
  formulaName: "MyFormula",
});

And my options are looking like this
image

There are no options, only the instructions are shown. How do I define the options to then use inside execute function? Is it in the formula, column, or something else?

This looked pretty close to the progress bar options: Interface: ProgressBarSchema - Coda Pack SDK
So I tried registering my own schema to the formula but to no avail.

I also thought any optional parameters might appear there by default, or that there would be another attribute such as the optional to make it appear in the options

I even tried searching the coda SDK organization for keywords I found in built-in options but no luck

Oh - I read formula, not pack. I honestly don’t know…

Hi @Rickard_Abraham - Unfortunately column formats created in a Pack can’t offer additional settings like the ones built-in to Coda. We’ve had some folks request this before, and I’ll add a note to the ticket.

2 Likes