cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
adstar22
Level: Powered On

create Comma Separated String from collection

Related to some of my other posts. I am trying to find ways around the unsupported multiple select choice check boxes. I want to select items from SPList2 and displays those selected in a field in SPList1 (my request list).

 

 

Current theory I am working on:

I can use a gallery, the items are those in SPList 2. I can apply a checkbox to each of the items displayed. 

If/When checked, the items are added to a collection (colTest). (and removed if unchecked).

 

So, at the end of the screen/process I have a collection of items I want to record against my request on SPList1.

 

ie colTest

Title - Some Text - Some other details

Item 1 - Description - ...

Item 2 - Description - ...

Item 6 - Description - ...

 

My problem, is how to a get the Titles of each item in colTest into a single text field in SPList1 ie: "Item 1, Item 2, Item 6"

 

I cant work out how to combine concat, concatinate, and forall to produce the desired output. 

Is it possible... any examples available?

1 ACCEPTED SOLUTION

Accepted Solutions
PowerApps Staff CarlosFigueira
PowerApps Staff

Re: create Comma Separated String from collection

You can use the Concat function for that, as shown in the example below:

Concat(colTest, ", " & Title)

Now, with this you'll end up with an extra ", " in the beginning of the sentence (", Item 1, Item 2, Item 6"), so you can use the Mid function to remove those extra characters:

Mid(Concat(colTest, ", " & Title), 3, 1000)

I used a very large third argument so that it would take all characters until the end.

View solution in original post

5 REPLIES 5
PowerApps Staff CarlosFigueira
PowerApps Staff

Re: create Comma Separated String from collection

You can use the Concat function for that, as shown in the example below:

Concat(colTest, ", " & Title)

Now, with this you'll end up with an extra ", " in the beginning of the sentence (", Item 1, Item 2, Item 6"), so you can use the Mid function to remove those extra characters:

Mid(Concat(colTest, ", " & Title), 3, 1000)

I used a very large third argument so that it would take all characters until the end.

View solution in original post

adstar22
Level: Powered On

Re: create Comma Separated String from collection

This looks really good. I havent tried it yet. but thanks for clarifying the syntax.

If I leave the 1000 out (blank), wouldnt the MID function read to the end of the string anyway?!

Thanks

Adam.

PowerApps Staff CarlosFigueira
PowerApps Staff

Re: create Comma Separated String from collection

No, you need to pass the last parameter, it's not optional. It should be, though, I'll try to talk to the people who own that to make it. For now, using a very high value as the last parameter is a possible workaround.

Meneghino
Level 10

Re: create Comma Separated String from collection

serastpan
Level: Powered On

Re: create Comma Separated String from collection

This one will remove the commas as well: 

 

Right(Concat(colTest), Len(colTest, Concatenate(", ", colTest))-2)

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 62 members 3,514 guests
Please welcome our newest community members: