Two technical questions

Reposting from @419:

cc @connormccormick83

Not sure on the first one without an example/screenshot.

For the second one, you can link to a document and get its stub for formulas. To do so, your table needs a link to the document, and then you can use concatenate() to strip all rich text information.

The formula used for the stub column is

=concatenate(thisRow.Page)

Hope this helps! (edit: without being able to link to a specific bookmark / header, there’s not currently a way to extract those unique IDs on the URL’s hash AFAIK)

2 Likes

I actually don’t have an example, was just trying to think of a question that I haven’t already had answered by the team in a private chat.

The request could be translated to “instead of setting conditional formatting at a Table level, could a conditional formatting modal be initiated when adding a trigger call to a cell?”

For example, if I type “##” then the conditional formatting menu could pop up when editing a formula. This may be more useful than the original question.

@connormccormick83 @evan

@jakobheuser Thank you for the reply! Follow-up questions:

  1. Stub?
  2. Unique IDs on the URL hash? What do these indicate?

@419 A stub is just a slang term for the URL fragment attached to a section in coda (maybe there’s an internal name for it?)

The anatomy of a Coda URL looks like this. note: reverse engineering, not guaranteed to be accurate, but it’ll at least be close

https://coda.io/d/<document>/<section>#<bookmark>
  • document: This is the coda document, followed by a unique ID. For example, My-Foo-Doc_d7hhhhhhbWl has a document title of “My Foo Doc” and has a unique ID of d7hhhhhhbWl (edited). The Unique ID remains constant, even as the first half of the document name changes.
  • section: The section follows an identical structure like “My-Section-Title_suvcp”. In this one, “My Section Title” was the section title name, and suvcp is the unique section ID (what I was calling the “stub”).
  • bookmark: Every single line break, formatting change, table, or otherwise identifiable position in a coda doc has a bookmark that appears after the # symbol. It looks something like _luI55 and you’ll see it change as you click around within a section.

While we can’t get the unique ID for the document yet, we can get it for the section. This means we can create links to sections with our own custom text, overriding Coda’s default behavior.

The final column is a custom hyperlink that uses the stub and builds a new URL, setting the text to another column.

Right now, this is just a cool way to get at the section URLs and mutate them, but it’s one step closer to accessing the value at a specific bookmark location. Some uses of this pattern I can think of

  • large coda docs that need a Table of Contents that may not map to the section hierarchy on the left bar
  • the need for a link to a section to remain the same when the section title changes (right now, links will update which could confuse users in larger docs)
  • With document support, it’s possible to cross-link coda docs efficiently since the uniqueID of a section and document remain the same regardless of changes. (note: this requires thisDocument.documentId() which doesn’t exist yet)

Great questions!

3 Likes

For the first one, this is a way to conditionally format a cell using a formula that references the values in other cells:

Is that what you’re looking for?

@419

3 Likes

@jakobheuser Thank you for the detail!
@cnr Much appreciated! That will help for the time being :slightly_smiling_face:

@jakobheuser I’m curious why you thought about using concatenate() to get the rich text from the link? The first formula I thought about was toText() so in your example, the formula would be =thisRow.Page.toText().

Based on your example wouldn’t the unique ID for the document be d7hhhhhhbWl? Seems like we can do some regex work and search for the string after the first underscore up to the slash (before the section is printed in the URL).

Hey @Al_Chen great questions.

RE concatenate, I ended up using concatenate() because I knew it would strip the information (from a prior experiment). toText() is certainly a cleaner option!

Regarding the ID of d7hhhhhhbWl I can manually get it from the URL, but it would be much easier if there was an option like thisDocument.documentId() we could call to get the information. My guess is that such APIs and data will show up once the coda team has a better idea of how they want to do cross-document linking.

2 Likes

I’m trying to create a central table for document classification and then call values from this table to classify documents. I was thinking that the ability to cross link documents was already in place but after reading this topic I’m starting to think that it doesn’t exist at all.

Has anything changed since this conversation ended?