Skip to main content
March 20, 2024
Question

Retain Carriage Return or Line breaks

  • March 20, 2024
  • 2 replies
  • 0 views

Hi,

I have a paragraph field in my interface, I am sending the user comments from this field into email. The line breaks are not retained and all the text is displayed in a single line.

So I have figured out that, if I can store the expression type of the data into local variable, I can replace the char(10) with </br> while passing into email. 

I need help in storing the expression format of the value. How can I do that?

    2 replies

    davidj137213
    March 20, 2024

    Store the value of the paragraph field in a variable, and when you need to use it , replace the value with an expression rule


    For example

    Interface :

    a!localVariables(
    local!texto,
    a!formLayout(
    label: "Form",
    contents: {
    a!sectionLayout(
    contents: {}
    ),
    a!sectionLayout(
    label: "Section",
    contents: {}
    ),
    a!paragraphField(
    label: "Paragraph",
    labelPosition: "ABOVE",
    saveInto: {local!texto},
    refreshAfter: "UNFOCUS",
    height: "MEDIUM",
    validations: {}
    )
    ,
    /*This is only for testing purposes in order to check how it works*/
    a!paragraphField(
    label: "Paragraph",
    labelPosition: "ABOVE",
    saveInto: {local!texto},
    refreshAfter: "UNFOCUS",
    height: "MEDIUM",
    validations: {},
    value: rule!D_formatText(local!texto)--> This is the expression rule
    )
    },


    ))

    Expression rule:

    a!localVariables(

    substitute(ri!texto, fn!char(10), "<br>")
    )

    mikes0011
    Brainy
    March 21, 2024
    I need help in storing the expression format of the value

    You're mistaking what you're seeing in the output.  The line breaks *are* stored in the saved value, regardless of whether you select "Expression view" - that merely changes how it's formatted by Appian for output on your screen in that case.  When you leave it set to "formatted", sadly, Appian strips out extra stuff like Line Breaks (i kinda wish they'd change this, as it makes certain troubleshooting unnecessarily difficult).  If you were to change the output to the "Raw" setting though I believe you'd see your lines split by linebreaks basically as expected.