Fix text wrapping in inline formulas when pulling text from tables

Not sure if this counts as a suggestion or a bug.

I’m using inline formulas to create some dynamic text content. For ease of editing and access, I’d hoped to pull the text from a single-row table, so my formulas stay readable. However, whenever I try this, the inline formula forgets how to do line wrapping, and the text just runs off the right side of the page.

The issue goes away if I paste the text directly into the formula.

Fixing the formatting here would be very helpful. :slight_smile:

1 Like

Hello @Sam_Stowers, thanks for your feedback.

I have logged a bug for this issue.
As a workaround, please add this ‘.toText()’, at the end of your formula it will makes your text wraps properly.



Thanks for the workaround! Much appreciated.

@Sam_Stowers, would you mind sharing the formula that caused the text to run off the page?

If adding ToText() helped, I’m guessing that the formula was returning a full row of a table or an array of multiple rows even if there was only one row.

Hi @BenLee,

Formula below. Not sure how to format it nicely, so will also include a screenshot for readability.

SwitchIf([General User Data].[Sleep Efficiency Average Last 7 Days]<0.84,[Treatment Content].[Titration Reduce],[General User Data].[Sleep Efficiency Average Last 7 Days]>=0.84 AND [General User Data].[Sleep Efficiency Average Last 7 Days]<0.90, [Treatment Content].[Titration Maintain], [Treatment Content].[Titration Increase])

I think the preview text turns blue when Coda is returning a row instead of a specific value (of course, you’d know for sure). Hence why this seems to be a cell value and not a row. Also relevant: the table in question (Treatment Content) only has one row in it.

If it’s better form to change the shape of the table to use rows instead of columns, I can do that?

I’m so happy you shared a screenshot as well! There’s a subtle clue in there showing the issue you were running into. The “T” icon for the value that’s returned isn’t a single square, it’s a stacked icon. This means that it’s returning any rows that match the statement. So even if it’s only one row, it’s still returning as an array.

ToText() forces this to a text value or you could add .First() after each item to only pull in the first row in the formula.

Gotcha - makes sense. Thanks for the explanation - good to know what to look out for in Coda’s visual language. :slight_smile: