(LongText) Line Breaks not Carrying over to Report

Good Afternoon Everyone,

I have a report in which the user can set some custom text, greetings, signitures etc,

What seems to be happening is the line breaks that the user has entered in are not being carried over to the report. The output is in 1 long string.

User Email Settings in the App. Column Type (Long Text)

Spreadsheet Cell. Appsheet places into Cell Correctly

Report Output

Anyone have any Idea what could be causing this and what can be done to prevent it?

Thanks,

What does your template look like?

wow, forgot that part.

<<Any(Settings[Custom Greeting (Based on 9:00am Sending Time)])>>

This is what I am using.

Settings[Custom Greeting…]

Will convert all of the values from this column in the table into a List type. I’m wondering if the LongText newlines get lost during that conversion. Is there any other way you can reference this value?

Maybe if you were to move into the context of that one row of the table with a single-iteration Start expression, then reference the column directly it would work.
<<START:FILTER( Settings , condition )>><<[custom greeting...]>><<END>>

Alternatively, make a new column in Settings table to substitute all newlines with some special character. Then in the template substitute it back.

SUBSTITUTE( [custom greeting…] , "
" , “*”)

<<SUBSTITUE(Any(Settings[new column]) , “*” , "
")>>

It’s also possible that I’m completely missing the real issue and have hugely overthought this.

2 Likes

Yep. ANY() returns Text, not LongText. Both of your workarounds look good to me.

2 Likes

So I’ve Tried the above and get a blank result.

Expression in Template
<<START:FILTER( Settings , isnotblank([Custom Greeting (Based on 9:00am Sending Time)] ))>>
<<[Custom Greeting (Based on 9:00am Sending Time)]>>
<>

The Second Option Also Gives a blank output. :frowning:

Formula in Template
<<SUBSTITUTE(Any(Settings[Substitute]) , “*” , "
")>>

Formula in Table

I just tried both of my suggestions, and both of them worked. Are you sure the longtext column itself isn’t blank?

Output:
image

Template (workflow run on a different table):
image

[sub] expression:
image

record:
image

2 Likes

So I have It setup just like you, It is replacing the new lines with the asterisk. It is also Taking the asterisk back out in the report… but it is not creating a new line. For some reason,

<<SUBSTITUTE(Any(Settings[new column]) , “*” , "
")>>

The formula above Does not cause it to create a new line. Everything is working as you described except when the report is created and sent it does remove the asterisk but for some reason everything just goes back to 1 line.

Is there Something else I can replace the * with to force a new line?

I realized that template expressions in the workflow’s “email body” field are parsed differently than when they are in an external template document, so I moved both expressions to an external document, and set it for both email body and attachment template. Only the START expression method worked here, NOT the double-substitute, so try that one instead.

3 Likes

Im not sure what i did wrong the first time I tried this :slight_smile:
Thank you very much. Works perfectly.

@Steve You Should Document this :wink: