Hi @acoliva,
I don't think you need to combine Concat & Concatenate functions, additionally the Collect function may not function as expected. Below I will display how to avoid the nested Concat & Concatenate functions and use a direct reference to the gallery to avoid using a collection.
(1) Concat accepts 3 parameters:
Concat(
//Your input table
ListBox.SelectedItems,
//Define the column to concatenate
Value,
//Define the separator
" ;"
)
//This will result in Item1 ;Item2 ;Item3
//In my next code block I will add some code to append Item3 with a semicolon as well (as present in your example)
Using a Collect() function within the OnSelect will cause duplicates in your list. Imagine Item 1 in your gallery, you Select 2 in the ListBox (which will save 1 ; 2 ; to your gallery, since 1 is auto-selected), when you press 3 it will save another row containing 1 ; 2 ; 3 ; for the same gallery item. In other words, you will create multiple rows within your collection for the same gallery item when you select an additional item in the ListBox / unselect an item.
If possible, I would recommend not using a collection and using a direct reference to your Gallery instead:
(2) Use the Concat as the parameter of a Gallery.AllItems ForAll reference:
//This function can be used as e.g. in the Items property of another gallery
ForAll(
//Rename to the correct gallery name containing the listboxes
GalleryName.AllItems,
//Since your last item in the example also had " ;" at the end I added & " ;"
//Remove this should you not want it to be displayed after the last item
Concat(
ThisRecord.ListBox.SelectedItems,
Value,
" ;"
) & " ;"
)
The code above can also be used as an input to save all rows to a collection at once instead of using the Collect code in the OnSelect / OnChange of each ListBox:
ClearCollect(
ServicesSelected,
ForAll(<See Code Above>)
)
If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.
Thanks!