Hi Seb,
We got confused there for a while probably from the heading of the post. However, knowing your requirement I have come up with a different approach altogether where we can use a LINQ object to get the duplicate records. You can create a new business object and add the below External References ('S
ystem.Data.DataSetExtensions.dll', '
System.Core.dll') and Namespace Imports ('
System.Data.DataSetExtensions', '
System.LINQ') on the Page Description stage of your Initialize action for the LINQ queries to work properly. Also, ensure that the language is selected as '
Visual Basic':
Once you have the updated code options as shown above, create a new action named '
Get Duplicate Records' and pass two input arguments, Input Collection (Collection) and Field Name (Text). Based on the field name that you provide the duplicate records will be fetched from the Input Collection. Also set an Output parameter as Output Collection (Collection) for this action as shown below:
Add the code stage and use the below code with the input and out arguments as show:
Output_Collection = (From row In Input_Collection _
Group row By a = row(Field_Name).Trim.ToString Into grp = Group _
Where grp.Count>1 _
Select grp.ToList).SelectMany(Function(x) x).CopyToDataTable()
The run results are as follows:
Input Arguments:
Output Result:
You can publish the action and test the same from Process Studio. Let us know if this helps you out
🙂
---------------------------------------------------------------------------------------------------------------------------------------
Hope this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.