we have a table, Reports, that we use as a poor man’s version control for queries we use against our data warehouse.
there is a button, New Version, that creates a new row and copies certain fields forward. there is one field that is not copied, SQL, where i add some templetized text automatically instead. (its a backlink to the row so that when the SQL is pasted into a database query tool, we can easily find its origin in Coda)
i am using a Row changed automation as a trigger that clicks a button that adds text to the SQL field when it is blank.
up to here, it all works well.
my question is, for the text that i am programmatically adding into the SQL field, is there a way to format it as a code block of type SQL?
that would make the whole thing smoother because the way that it is now it is just plain text and the user needs to highlight all the text and format it manually.
thanking you in advance for any suggestions
-Uri
use ._Code() to render text as a code block
1 Like
Thanks!
is there a way to make it a code block instead of inline code?
Not with a simple formula.
Bu i believe there might be a way using the Format() formula usig a pre-formatted template text?
Or by manipulating the underlying objects in a richly formatted text block using _Merge() and _Object_Detef() or some such black magic.
But i am away from the office, so I cannot experiment just now.
well, nevertheless, many thanks for the information. i have no way of knowing anything about _Merge() or _Object_Detef() since they are not documented, if you figure out how this works in the future, please let me know.
So we dont need any black magic or ‘hidden’ functions.
We can generate a CODE BLOCK with the Format() formula.
Use a text column for the template that contains all the fancy formatting you need.
Place the {1}..{N} place-holders inside the formatted text.
Then the result of the Format() formula will include all the formatting of the template!
I use the Split() formula just to create the list of params for the {1}..{3} placeholders.
Your formulas will provide all the raw text needed as required.
➤𝖒𝖆𝖝
3 Likes
Is there a list of all the _Formulas that aren’t officially on formula page?
1 Like
I have compiled a list.
Will post is in a separate post.
But warning!
They are not supported, so we limit our use of them in production workflows. They work, and are safe if you know how they work.
But as much as possible, I try to only use supported formulas.
The Format() formula solution above is a safe, supported, solution.
2 Likes