cancel
Showing results for 
Search instead for 
Did you mean: 

Get difference btw two collections - using code stage

MuraliKrishna3
Level 2
i need to get the new collection from collection one and collection two. collection one and collection two have same columns, new collection should contain only the values that are present in the collection one but not in the collection two. if A, B are two sets i need to get the value of A-B = A⋂B

I need to perform this action using code stage not with the loops(input data is large so using loops will consume more time).

we can say as left semi join or left anti join.

Thanks in advance.
5 REPLIES 5

ewilson
Staff
Staff
Hello @Murali Krishna,

You can accomplish this using Linq and the Enumerable.Except() method. Here's an example Code stage based on the this example:

NoMatchRecords = coll1.AsEnumerable().Except(
        coll2.AsEnumerable(), DataRowComparer.Default).
            CopyToDataTable();
​

​And here are screenshots of the properties of the Code stage:
35113.png
35114.png
You will need to references to the following DLLs:
  • System.Data.DataSetExtensions.dll
  • System.Core.dll
You'll also need to add the following Namespace:
  • System.Linq

Cheers,
Eric

ewilson
Staff
Staff
FYI - We've taken the functionality I mentioned in my previous post and added it as an action on the Utility - Collection Manipulation VBO available on the Digital Exchange.​ The specific action is called Get Unmatched Records. You can find the latest VBO at the following link:

https://digitalexchange.blueprism.com/dx/entry/3439/solution/utility---collection-manipulation

Cheers,
Eric

Hi Ewilson,

Based on this VBO, it extracts differences but does not highlight the text, which is different from the main collection.

After using this VBO, the collection results  stored in New Excel sheet but the problem is we could not find it out what is the difference.

Please help me to resolve this issue

Regards

Sabitha N

 

 

 

Paste collection details into MS Excel, and use excel formula's to find the difference is there or not.

SabithaNirmal
Level 2

Thanks for your quick response, Please find the below my flow chart

SabithaNirmal_0-1716796728830.png

collection of unmatched record automatically created in collection and the i stored the collection value to New work book , If i open work book  it will show the difference but still need to find out, That New Unmatched VBO not highlighting the text from Main Collection.

This one i want to achieve using Blue prism only.

Please provide more detail to resolve this

Regard

Sabitha N