Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Split nested concatenated string values into 2 column collection

(0) ShareShare
ReportReport
Posted on by

Hello all,

 

I am building an app for a gymnastics tournament where participants for a certain exercise are listed with their sequential number. For example:

 

Exercise A has 5 participants with their unique ID number concatenated with their sequential number (delimiter "-"), concatenated into one text string using delimiter ";". So it is a nested concatenated list of participants and their sequence number: [1-1;2-5;3-2;4-4;5-3], meaning participantID 1 is first, participantID 2 is 5th and so on.

 

I want to split these strings into a two column collection like so:

ID   Sequence

1     1

2     5

3     2

4     4

5     3

 

Anybody have an idea how to do this?

  • ES-11101448-0 Profile Picture
    on at
    Re: Split nested concatenated string values into 2 column collection

    You're right, I got it working with a gallery and a collection just fine. Thanks for the help.

  • LaurensM Profile Picture
    12,510 Super User 2025 Season 1 on at
    Re: Split nested concatenated string values into 2 column collection

    @eschoo,

     

    I indeed think displaying the values as a table within an editable gallery would be beneficial UI/UX wise. I would not let the users view or edit the concatenated string directly as text.

     

    For more specific advice, we may need more information about your app or the set-up. Is there a specific reason why you think that a collection and gallery may not be the most optimal approach?

  • ES-11101448-0 Profile Picture
    on at
    Re: Split nested concatenated string values into 2 column collection

    Great! My apologies to all for the confusion about the square brackets. Without the Mid code it works perfectly.

     

    Do you have a better way to handle the editing of sequential numbers via a gallery using this colParticipants? Or is this the most convenient way?

  • ES-11101448-0 Profile Picture
    on at
    Re: Split nested concatenated string values into 2 column collection

    Wow thanks! That did the trick. My string doesn't have the brackets in the Sharepoint List entry, so using a second split function would also work. Would you mind showing me how this would work?

     

    So my Sharepoint list entry is: 1-1;2-5;3-2;4-4;5-3

     

    I want to show the participants and their sequential number in a gallery where the sequential numbers can be edited and saved. I am now doing this via this myCollection. Is there an easier way to do this as well?

  • Verified answer
    LaurensM Profile Picture
    12,510 Super User 2025 Season 1 on at
    Re: Split nested concatenated string values into 2 column collection

    Hi @eschoo,

     

    @CarlosFigueira's code will do the trick. Wouldn't have thought of doing it that way, thanks for sharing Carlos! 😊

     

    Just adding the code below as an example of how to achieve a similar result solely using PowerFx:

    ClearCollect(
     colParticipants,
     ForAll(
     Split(
     //Remove square brackets
     Mid(
     "[1-1;2-5;3-2;4-4;5-3]",
     2,
     Len("[1-1;2-5;3-2;4-4;5-3]") - 2
     ),
     ";"
     ),
     With(
     {wSplitValue: Split(ThisRecord.Value, "-")},
     {ID: First(wSplitValue).Value, Sequence: Last(wSplitValue).Value}
     )
     )
    )

     

    I hope this helps!

  • Verified answer
    CarlosFigueira Profile Picture
    on at
    Re: Split nested concatenated string values into 2 column collection

    You can use a combination of a few functions to accomplish what you need:

    • Split to break down the string in the parts separated by ';'
    • ForAll to loop through the parts from the previous step
    • Match to extract the two numeric parts, split by '-' (you could also accomplish it by using Split again, but you would need to remove the '[' and ']' at the beginning and end)
    • Collect and Clear to save the parts into a collection.
    Clear(myCollection);
    ForAll(
     Split("[1-1;2-5;3-2;4-4;5-3]", ";") As splitResult,
     With(
     { match: Match(splitResult.Value, "(?<id>\d+)\-(?<seq>\d+)") },
     If(
     Not IsBlank(match),
     Collect(myCollection, { ID: match.id, Sequence: match.seq })
     )
     )
    )

    Hope this helps! 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,651 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,997 Most Valuable Professional

Leaderboard