Hi Sai,
For your use case, as John suggested I would go with a custom LINQ query object which you can create easily using below steps.
Firstly, create a business object called '
Utility - Collection (LINQ)' and then add the
'External References' and
'Namespace Imports' in your Initialise action's Page Description stage keeping the language as
'Visual Basic' as shown below:
Create a new action called
'Get Element Count' and add two input parameters named as '
Input Collection' of type '
Collection' and '
Field Name' of type '
Text' and map the data items accordingly. Also, add an output parameter called '
Output Collection' of type '
Collection' and map the data item as well. In addition you need to create a local data item called as '
Temp Collection' of type '
Collection' which has two default columns called '
Field' of '
Text' type and '
Count' of '
Number' type. You can refer the screenshot below:
Once done add a code stage called
'Get Element Count' and map the input parameters for
'Input Collection', 'Field Name' and
'Temp Collection' along with output parameter as
'Output Collection' to the code stage and add the following code:
Output_Collection = (From row In Input_Collection.AsEnumerable() Group By col1 = row(Field_Name).ToString() Into Group Select Temp_Collection.Rows.Add({col1, Group.Count()})).CopyToDataTable()
Now you can test the code once. As in my case I have an input collection with two fields called 'Field1' and 'Field2' with some random values as you can see below:
Let say I want the count of elements from Field1 so I will set the 'Field Name' input parameter as 'Field1' :
And you can see the results upon code execution:
Hope it resolves your query!
------------------------------
----------------------------------
Regards,
Devneet Mohanty
Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,
Wonderbotz India Pvt. Ltd.
Blue Prism Community MVP | Blue Prism 7x Certified Professional
Website:
https://devneet.github.io/Email: devneetmohanty07@gmail.com
----------------------------------
------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
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.