web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Build Collection from ...
Power Apps
Answered

Build Collection from column with colon delimiter

(0) ShareShare
ReportReport
Posted on by 12

Hello,

 

I have a table that look like this: 


Name Pets
Tom ;Cat;Dog
Peter ;Bird;Rabbit
Mary ;Hamster

 

 and would like to get a collection from the Pets column:


Cat
Dog
Bird
Rabbit
Hamster

 

I have tried using ForAll and Split but still no luck. Would appreciate if someone can help me with this.

 

Thanks,

Kin

Categories:
I have the same question (0)
  • timl Profile Picture
    36,411 Super User 2025 Season 2 on at

    Hi Kin

    Can you confirm, is this a table with two columns called name and pets, or is this a single column table where each data row begins with the name followed by the name of the pets separated by a semicolon?

  • mdevaney Profile Picture
    29,989 Moderator on at

    @kccchiu 

    This code will produce a single column collection with a column called "Result" having all the pets.

    // Starting collection
    ClearCollect(colNamePets,
     {'Name Pets': "Tom;Cat;Dog"},
     {'Name Pets': "Peter;Bird;Rabbit"},
     {'Name Pets': "Mary;Hamster"}
    );
    
    // Solution collection
    ClearCollect(colSolution,
     Ungroup(
     AddColumns(
     colNamePets,
     "Pets", Remove(Split('Name Pets', ";"),First(Split('Name Pets', ";")))
     ),
     "Pets"
     ).Result
    );


     ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • kccchiu Profile Picture
    12 on at

    Yes, it is a 2 column table with header like you mentioned. Sorry for the confusion.

  • Verified answer
    timl Profile Picture
    36,411 Super User 2025 Season 2 on at

    @kccchiu 

    Let's assume a 2 column table that looks like this:

    ClearCollect(colNamePets,
     {'Name': "Tom", 'Pets': "Cat;Dog"},
     {'Name': "Peter", 'Pets': "Bird;Rabbit"},
     {'Name': "Mary", 'Pets': "Bird;Rabbit"}
    )

    This formula will return a table with a column called Result. This will contain a list of your pets.

    Ungroup(AddColumns(colNamePets, "PetTable", Split(Pets, ";")),"PetTable")

     

     

    timl_0-1603122546582.png

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard