array to text

Team,

I have below code :

a!localVariables(
local!data1:{"test1<br>","test2<br>"},
local!data1
)

Output is list of text strings

  • "test1<br>"(Text)
    • "test2<br>"(Text)

    I want the output to be in format "tetst1<br>test2<br>"

    Basically i am formatting a data before sending into email template but it is appearing like below , i want the semicolon to be removed.

    Test1
    ; Test2

    It should be like below

    Test1
    Test2

    ANy suggestions ?

      Discussion posts and replies are publicly visible

    Parents
    • In answer to your first question you can use fn!joinarray():

      fn!joinarray(
        a!localVariables(
          local!data1: { "test1<br>", "test2<br>" },
          local!data1
        )
      )

      If you want to have the output actually on separate lines (as is indicated by your second question) then you can loop through your input items and append a "new line" Unicode character to all items except the last item:

      a!localVariables(
        local!myList: { "Test1", "Test 2", "Test 3" },
        local!myResult: fn!joinarray(
          a!forEach(
            items: local!myList,
            expression: if(
              fv!isLast,
              fv!item,
              concat(fv!item, char(10))
            )
          )
        ),
        { a!paragraphField(value: local!myResult) }
      )

    Reply
    • In answer to your first question you can use fn!joinarray():

      fn!joinarray(
        a!localVariables(
          local!data1: { "test1<br>", "test2<br>" },
          local!data1
        )
      )

      If you want to have the output actually on separate lines (as is indicated by your second question) then you can loop through your input items and append a "new line" Unicode character to all items except the last item:

      a!localVariables(
        local!myList: { "Test1", "Test 2", "Test 3" },
        local!myResult: fn!joinarray(
          a!forEach(
            items: local!myList,
            expression: if(
              fv!isLast,
              fv!item,
              concat(fv!item, char(10))
            )
          )
        ),
        { a!paragraphField(value: local!myResult) }
      )

    Children