Hello:
I am looking to convert an array of number to a single string with comma as the separator. In 23.1, they have a function called a!joinarray which seems to be the function I want to use but I am on 22.4 CE. So, the question is there a similar function that will enable me to accomplish this?
Thank you.
Final desired result: 360392, 361150, 361177, 377913, 378165
Discussion posts and replies are publicly visible
Found the answer - substitute(tostring(local!fdcIDSublist),";",",") does what I want
There is no "a!joinArray". There is regular "joinArray()" which has been around for many years now (long before any of the "22.x" versions). What's wrong with just using this, regular, joinArray()?
e.g.: joinArray(local!myList, ", ")
Good to know the substitute approach, but yes I use joinArray() almost every day to do what you said, and I have for many years.
Yeah, the substitute approach seen here works, but also only kinda by accident - because by casting the array as a string using tostring(), you get Appian's plaintext rendering of the array with the "; " separators, then stripping those out using substitute. But that totally depends on the behavior of casting an array to a string, which I don't believe there's any particular guarantee will always behave the same way - so of course the cleaner way is handling the array itself, and not taking the extra intermediary steps.
Dave,
Is there a version of a!joinArray I can use for 22.4? My 22.4 community edition doesn't allow me to use joinArray.
Mike,
If I understand you correctly, you are also suggesting that I should use joinArray? But for community edition 22.4, I can't seem to find a version that work. Am I missing something?
MaNa said:Am I missing something?
Yes, I assume you're missing something, but I have no idea what it might be - so please post the code you're attempting to use, and a screenshot showing it plus the result (and any other context). I've been using joinArray() since at least 2014 or so, and all Appian versions after that, so I am confident that our CE instances have it.
Edit: here's code and a resultant screenshot that I literally just typed into my 22.4 CE instance:
a!localVariables( local!arrayOfNumbers: { 234235, 45324052, 8934, 1, 358905998 }, joinarray(local!arrayOfNumbers, ", ") )
I didn't know about the regular joinArray.
Thanks
it's the only one i know about
Also, didn't you just say your 22.4 CE instance "doesn't allow" you to use it? I'm confused what you were referring to, then.
Mea culpa/apologies - I shouldn't have put the 'a!' in my code - I was trying to use 'a!joinarray' (realize it doesn't exist) when I should have been using 'joinarray'. I was using a!update and a!flatten as part of that code and didn't may close attention to the fact that joinarray doesn't have the 'a!' prefix.