Skip to main content
Inspiring
March 1, 2021
Solved

Stripwith not returning expected result.

  • March 1, 2021
  • 3 replies
  • 0 views

Hello, I have the following example: 

ownerString is a text string: email1@gmail.com; email2@gmail.com

value: a!forEach(
items: split(fv!row.ownerString, ";"),
expression: stripwith(fv!item, ";")
)

the result of this code is: 

email1@gmail.com;

email2@gmail.com

Where the expected result have to be 

email1@gmail.com

email2@gmail.com

in order to be used inside user() function.

The difference is the ;  which is not being removed. 

Any suggestions are welcome

Thank you. 

    Best answer by mikes0011

    Secondarily, if you're calling "split()" on the ";" character, there should be no need to pass it through "stripwith" also.  You probably need to pass each output through "trim" to deal with unnecessary spaces, though.

    3 replies

    mikes0011
    Brainy
    March 1, 2021

    Can you post a screenshot of the output you're getting?  Without seeing this, I can guess that what you're actually seeing is the array output, which Appian automatically formats using a ";" in between each returned member, for the purposes of visibility (depending on which formatting you choose to have it show you).  This wouldn't be included in your "stripwith" since it's not actually data contained in the returned elements.

    The Expression Guru
    mikes0011
    mikes0011Answer
    Brainy
    March 1, 2021

    Secondarily, if you're calling "split()" on the ";" character, there should be no need to pass it through "stripwith" also.  You probably need to pass each output through "trim" to deal with unnecessary spaces, though.

    The Expression Guru
    Inspiring
    March 1, 2021

    you are correct, the problem was the trim()

    thank you as always!