How can I remove the trailing semicolon when displaying the output of a!forEach().

I am looping through a data type process variable using the a!forEach() function. The output is displayed in an email body. There is a trailing semicolon character after all but the last row Example:

this is some text;

this is some text;

this is some text;

this is some text

I have tried using the stripwith() function to remove the semicolon, but that does resolve the issue.

  Discussion posts and replies are publicly visible

Parents Reply Children
  • Hi. What do you mean by "five the a!forEach()"?

    The documentation you linked to says that data types would retain their structure in the a!flatten function. This may be the case here as a tried it and still had semicolons in the output.

    I wrapped our function using joinarray() and that seemed to do the trick. Thank you for the help.

    Example code

    joinarray(a!forEach(
    items: pv!output,
    expression: "First Name: " & fv!item.property1 & ", Last Name: " & fv!item.property2), "")

  • 0
    Certified Lead Developer
    in reply to seze

    You were returning not one string, but a list of 4 strings.  Any user facing output displays the list of strings as a list in a string.  It does this through implicit casting, which includes adding those super handy semicolons for you.

    When you a!flatten(), you magically transform your list of strings . . . into a list of strings.  It literally does nothing to an array that's already not nested.

    joinarray() takes a list of whatever and crams them all into one string, with an optional separator, so you can replace semicolons with even more annoying @ or # or $ if you want to.