HI ,
I have a requirement where I need to pass Sting values with separate Line to API .
here is the List of Sting with 4 items.
“28978937982932090”
“28978937982932091”
“28978937982932092”
“28978937982932093”
I want to send it as single string with line break to API
“28978937982932090
28978937982932090
28978937982932090”
Can you help me with this scenario.
Thanks in advance
Discussion posts and replies are publicly visible
Why do you need to transmit them "with line break" as opposed to just transmitting a list and letting the remote end deal with the list in whatever way it needs? The standard for transmitting lists via a simple single string would be JSON, and you can very easily transform a list of string items to JSON in Appian using a!toJson(). JSON is a standardized format so the remote end should be able to unpack the list with arbitrary difficulty and treat it however is needed.
I have the same question. Just use a delimiter.
A delimiter would work too, though I've done this before and you quickly run into the issue of having to build your own parser and potential corner cases (though for "list of integer as string" the corner cases are admittedly few), while JSON should automatically that, which is why I default to suggesting JSON before other approaches (noting, of course, that neither is "wrong" per se).
I've had this need for line breaks when using a Web API to export data into a spreadsheet. Using the joinArray suggestion above did the trick
Agreed, if the remote end is preconfigured to recognize linebreaks (and linebreaks only), the code you posted originally should work fine I think.