cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

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
Highlighted
Community Support
Community Support

Re: Merging Two Records of collection

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
Highlighted
Community Support
Community Support

Re: Merging Two Records of collection

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

Highlighted
Frequent Visitor

Re: Merging Two Records of collection

It Worked Excellent. Thnks so much. 

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

 

 

Highlighted
Community Support
Community Support

Re: Merging Two Records of collection

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

Highlighted
Frequent Visitor

Re: Merging Two Records of collection

Tq So Much 🙂

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (4,346)