Concatenate a string into each element of a list

Hello I would like to ask whether this could be done on Appsheet. 

Suppose I have a list of strings: [A, B, C, D] and I want to concatenate a single string, say, "TEXT - " to each element on the list such that the output would be:

[TEXT - A, TEXT - B, TEXT - C, TEXT - D]

Also, while finite, the elements on the list can vary (some records/rows would have 2, 3, or more elements in the list).

Given that there is no direct way of looping on AppSheet, could this be done on AppSheet?

Thank you so much!

0 5 445
5 REPLIES 5

I have dealt with situations like this in the following way.  Let's say my finite list has a maximum of x elements.  I just made a really long expression that was essentially made up of x number of expressions, one for each item in the list.

But the thing is, with my case, I can't know for sure how many elements would there be in that list. The list is composed of a user input, so the list can have as little as 1 to as many as 10 or even more elements.

I understand.  Perhaps there's a better way but I guess I would be forced to come up with a long expression that was something like "if there's a third item in the list, do this, if not, do nothing, . . .if there's a forth item in the list, do this, if not, do nothing, . . ." etc.  Maybe someone else has a better idea but that's all I know to do.

"TEXT - " & SPLIT( SUBSTITUTE( TEXT( [list] ) , " , " , " , TEXT - " ) , " , " )

Very cleaver!  A much better approach than what I had in mind.  But, come to think of it, I've done something similar -- just slipped my mind this time.  SUBSTITUTE() and SPLIT() are very useful for situations like this!  

Top Labels in this Space