Is it possible to further constrain coda.ValueType.String?

I’d like to define a schema called TwitterUsername and specify that it must be a string whose first character is the “@” symbol. Or I’d like to define a type called format and specify that it’s a string but must be one of five pre-defined values. (surprised I can’t annotate with a Select or Enum coda.ValueHintType?)

These are sort of weird value-type based operations and I am trying to suss out the boundaries of the existing type system as well as plans around it. Anyone messed around with this? :slight_smile:

What I’ve done in the past is usually one of two things:

  • make an additional column with a formula that either checks the format or converts it to proper format (or both)
  • Simply apply conditional formatting with a regex formula — it won’t change the value, but at least the user will get immediate visual feedback.

I have wanted to make an automation rule to automatically check/format strings, but it’s too slow. It can be confusing and/or jarring for the user.

You’re talking about the Packs SDK, right? Where exactly are you trying to enforce those formats?

One option is autocomplete + validation, depending on where you’re trying to enforce this:

https://coda.github.io/packs-sdk/guides/advanced/autocomplete/

1 Like

on input data, generally. It’s just a way to guarantee that certain conditions are met for an input to be valid for the formula.