cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Krishna98
Helper V
Helper V

Merging Two Records of collection

I've Collection as attached below.

 

In that Collection i'm having two values i.e SharePoint;Nintex and Nintex;Sharepoint. so i have to merge both of the values into single value as SharePoint;Nintex and i've to remove the duplicated value i.e Nintex;Sharepoint in the final collection 

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @Krishna98 :

Your needs can be solved using the matching function.I've made a test for your reference:

1\My data source-YourCollection

ClearCollect(YourCollection,["SharePoint;Nintex","Nintex;SharePoint","SharePoint;Power Platform"])

2\Add a button and set it's OnSelect property to:

ClearCollect(
    YourCollection,
    RenameColumns(
        Distinct(
            AddColumns(
                YourCollection,
                "NewColumn",
                Concat(
                    Sort(
                        Split(
                            Value,
                            ";"
                        ),
                        Result
                    ),
                    Result,
                    ";"
                )
            ),
            NewColumn
        ),
        "Result",
        "Value"
    )
)

19.gif

Best Regards,

Bof

View solution in original post

4 REPLIES 4
v-bofeng-msft
Community Support
Community Support

Hi @Krishna98 :

Your needs can be solved using the matching function.I've made a test for your reference:

1\My data source-YourCollection

ClearCollect(YourCollection,["SharePoint;Nintex","Nintex;SharePoint","SharePoint;Power Platform"])

2\Add a button and set it's OnSelect property to:

ClearCollect(
    YourCollection,
    RenameColumns(
        Distinct(
            AddColumns(
                YourCollection,
                "NewColumn",
                Concat(
                    Sort(
                        Split(
                            Value,
                            ";"
                        ),
                        Result
                    ),
                    Result,
                    ";"
                )
            ),
            NewColumn
        ),
        "Result",
        "Value"
    )
)

19.gif

Best Regards,

Bof

It Worked Excellent. Thnks so much. 

can u explain the formula that what u have done here @v-bofeng-msft 

 

 

Hi @Krishna98 :

Let me explain this code:

ClearCollect(
    YourCollection, /*Step5:Overwrite the original data in YourCollection with new data*/
    RenameColumns( /*Step4:Rename the column name of the table after deduplication (because the column name of the return value is "Result")*/
        Distinct(  /*Step3:De-duplication according to the value in NewColumn (because the string has been rearranged in order, duplicate values with different orders can be deleted)*/
            AddColumns(
                YourCollection,
                "NewColumn",  /*Step2:Add a new column"NewColumn", fill it with the value obtained in Step1*/
                Concat(   /*Step1:Split the character string in value according to ";", arrange it in order and re-integrate it into a new uniform string in a certain order*/
                    Sort(
                        Split(
                            Value,
                            ";"
                        ),
                        Result
                    ),
                    Result,
                    ";"
                )
            ),
            NewColumn
        ),
        "Result",
        "Value"
    )
)

 Best Regards,

Bof

Tq So Much 🙂

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,606)