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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Create a column of val...
Power Apps
Answered

Create a column of values from a column of comma separated string

(0) ShareShare
ReportReport
Posted on by 12

Hello all,

In a collection called mergedData contains different columns.

I have a column named Tag that allow a row to contains multiple values (Choices from Sharepoint) such as this one:

kccchiu_0-1603481996163.png

I also have a column named UserTag that contains multiple values but as a string:

kccchiu_3-1603482272521.png

I would like to add a column to the collection that has the same data type as Tag but for UserTags. Is it possible?

 

 

Thanks in advance.

 

Thanks,

Kin

 

Categories:
I have the same question (0)
  • PowerRanger Profile Picture
    3,458 Super User 2024 Season 1 on at

    @kccchiu 

     

    As I'm only on my mobile I can't verify the Syntax but try something like

     

    Set(mergedDataV2, AddColumn(mergedData, tagRecordColumn, Split(UserTag, ","))) 

     

     

  • kccchiu Profile Picture
    12 on at

    Thanks for the reply, but I have built quite a lot of things around the mergedData collection and would like to have the new column in the mergedData collection.

    I have tried your formula but had some error.

     

    Thanks,

    Kin

  • kkowal Profile Picture
    58 on at
    Hi! What kind of type is the UserTag field? Is it a simple String? or is it an Object? Can you post the line of code how you created it? I think this would help us to help you 🙂 With regards PowerCorner
  • kkowal Profile Picture
    58 on at
    Hi! What kind of type is the UserTag field? Is it a simple String? or is it an Object? Can you post the line of code how you created it? I think this would help us to help you 🙂 With regards PowerCorner
  • kccchiu Profile Picture
    12 on at

    Hello Thanks for the reply.

    The UserTag field is just a string and it follows a pattern like:

    string1, string2, stringn

     

    The UserTag column is from a sharepoint list, and the type of column is single line of text.

    I had to work with different sharepoint list so I had to merged 2 lists into a collection.

     

    Thanks,

    Kin

  • kkowal Profile Picture
    58 on at

    Okay, so you should first split the UserTag with the Split(UserTag,",") function. Then you will have a collection of strings.

     

    But wait... so you have two different lists. So dont merge the UserTag directly with the tags. First split them and then merge them with the tags!

  • PowerRanger Profile Picture
    3,458 Super User 2024 Season 1 on at

    @kccchiu 

     

    Once your mergedData Collection got created you can't add any new columns. Thats simply not possible.

     

    I have tried this:

    ClearCollect(mergedData,mySharePointList);
    
    ClearCollect(mergedDatav2,AddColumns(mergedData,"UserTagAsRecord",Split(ThisRecord.'UserTag',"-")));

    mergedDatav2 is identical to mergedData but has the addition UserTagAsRecordColumn

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • kccchiu Profile Picture
    12 on at

    Thanks for the reply.

    I tried your formula and got this result:

    kccchiu_3-1603493278325.png

     

    Is it possible to achieve this?

     

    kccchiu_2-1603493264414.png<-- I used paint to illustrate the result I want.

     

    Thanks,

    Kin

     

  • PowerRanger Profile Picture
    3,458 Super User 2024 Season 1 on at

    @kccchiu 

     

    The only difference is that using my formula the field UserTagRecords is a Table and you want it to be Records.

    I actualy can't see any benefits.

     

    You might be confused because it still shows as comma separated values but this is not th case.

     

    Add a Gallery and use mergedDatav2 as the datasource. Add a second Gallery and use Gallery1.Selected.UserTagRecords in the Items Property. You will see you get each item displayed in a separate row.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • PowerRanger Profile Picture
    3,458 Super User 2024 Season 1 on at

    PowerRanger_0-1603494805659.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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 326 Most Valuable Professional

#2
11manish Profile Picture

11manish 168

#3
sannavajjala87 Profile Picture

sannavajjala87 75 Super User 2026 Season 1

Last 30 days Overall leaderboard