cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kccchiu
Regular Visitor

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

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

 

1 ACCEPTED SOLUTION

Accepted Solutions

@kccchiu ,

This should work

ClearCollect(
   colMyCollection,
   AddColumns(
      mergedData,
      "MyNewColumn,
      Split(
         UserTag,
         ","
      )
   )
)

 

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.

View solution in original post

12 REPLIES 12
PowerRanger
Resolver II
Resolver II

@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, ","))) 

 

 

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
Frequent Visitor

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
Frequent Visitor

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
Regular Visitor

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
Frequent Visitor

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!

@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.

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

 

@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.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (47,604)