Skip to main content
Participating Frequently
Dec 6, 2024 11:49 AM UTC
Question

How to concat extra spaces other than using concat function in a value?

How to concat extra spaces other than using concat function in a value.

To convert a list of text strings to a string, concat is not working if it has multiple spaces in a sequence. 

Eg: {"a"," "," "," "," "," "," ", "b"}

Actual output

using concat is "a b"

using to string function "a; ; ; ; ; ; ; b"

Expected output

"a      b"

    9 replies

    mikes0011
    Brainy
    Dec 6, 2024 3:20 PM UTC

    Concat is working fine, just make sure to view Raw Output...  the formatted output seems to trim the (displayed) output value.

    using to string function "a; ; ; ; ; ; ; b"

    Please keep in mind - toString() merely takes the human-readable appian interpretation of a string output, then casts that as a string.  The spaces seen between each semicolon aren't actually from the data, they're originally just there for readability.  There's no reason to assume concat() would come up with anything like this, since concat() deals ONLY with the actual data in the array, not adding extra fluff for readability like the default output does.

    The Expression Guru
    Participating Frequently
    Dec 9, 2024 8:02 AM UTC

    Thanks for the response, even I can see the spaces in raw output, but I'm expecting the same from formatted value to use at different places

    peter.lewis
    Employee
    Dec 9, 2024 2:13 PM UTC

    The formatted value is exactly what it sounds like - a formatted result. The raw result is what is actually used when you pass it to other expressions.

    somasundaram.d
    Employee
    Dec 9, 2024 9:22 AM UTC

    You can use the rule that uses concat directly in the necessary places, it will display only the raw output and not the formatted one

    Participating Frequently
    Dec 9, 2024 9:58 AM UTC

    Thanks for your reply, I need it in expression rule not on UI and it is not for display on UI. I need to pass this value to an external system.

    somasundaram.d
    Employee
    Dec 9, 2024 11:03 AM UTC

    Did you try passing the output to the external system? Is it getting formatted there?