Hi everyone,
I have a Structure like this:
MyStructure- Value (Text)
On my screen, I have a List of MyStructure.
I want to convert the list into a single Text value, similar to String_Join().
For example:
List:- Apple- Orange- Banana
Expected result:
Apple, Orange, Banana
Is there a built-in function in OutSystems to do this, or what's the recommended approach?
I'd prefer to avoid using a For Each loop if possible.
Thanks!
Hi @Mahmoud Mohamed,
You can use BuildSafe_InClauseTextList.
For example, in the screenshot, I have a variable called Var, which is a list strucutre. Another variable In1 is of type TextLiteral List. You can obtain this type by consuming the BuildSafe_InClauseTextList action from the Sanitization.
Next, use ListAppendAll to append your list data into the TextLiteral List (avoiding the loop as you mentioned). This converts the values into a safely formatted, comma-separated list.
Last 4 Screenshots I launched the Debugger for you to see the results, the action BuildSafe_InClauseTextList will add N' but you can use Replace to avoid this getting the results you want.
Also attached the OML for you.
Hello.
You can use String_Join.
String_Join is expecting a text and you have a structure? You just need to do mapping.
Just say that the attribute Value of Join is filled by the attribute Value of the Structure and it will work.
It accepts record list and return the string according to the separator you provide
Hi ,
I agree with Nuno if you want to use String Join you have to mapping with structure
Check with this Sample OML it will help you