<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic RE: How to get count of unique items in collection - Scenario. in Product Forum</title>
    <link>https://community.blueprism.com/t5/Product-Forum/How-to-get-count-of-unique-items-in-collection-Scenario/m-p/70225#M22830</link>
    <description>Hello Tejas,&lt;BR /&gt;There's some nested looping trickery that's required here.. Basically you want to pick up the value in the first row and loop through the collection and at the same time incrementing a counter as soon as you find a duplicate. Once the loop's done capture the value and the counter in a new collection. Now reset the counter and begin again.&lt;BR /&gt;&lt;BR /&gt;Alternatively, you could also paste that column into an excel and apply some vlookup formulas..&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Harpreet&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Harpreet Kaur Product Consultant&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
    <pubDate>Mon, 23 Aug 2021 00:35:00 GMT</pubDate>
    <dc:creator>HarpreetKaur</dc:creator>
    <dc:date>2021-08-23T00:35:00Z</dc:date>
    <item>
      <title>How to get count of unique items in collection - Scenario.</title>
      <link>https://community.blueprism.com/t5/Product-Forum/How-to-get-count-of-unique-items-in-collection-Scenario/m-p/70224#M22829</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;I have a collection with various numbers in each row. There can be duplicate values present. &lt;BR /&gt;&lt;BR /&gt;What I want as output are 2 columns where I get all unique numbers in the 1st column, and in the 2nd column, I need a count of that number showing that how many times it is present in the collection.&lt;BR /&gt;&lt;BR /&gt;e.g. Input Coll-&lt;BR /&gt;10&lt;BR /&gt;10&lt;BR /&gt;12&lt;BR /&gt;11&lt;BR /&gt;10&lt;BR /&gt;12&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Output Coll-&lt;BR /&gt;10 |&amp;nbsp; 3&lt;BR /&gt;11 |&amp;nbsp; 1&lt;BR /&gt;12 | 2&lt;BR /&gt;&lt;BR /&gt;Which VBO/Actions can be used to achieve this!&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Thanks &amp;amp; Regards,&lt;BR /&gt;Tejaskumar Darji&lt;BR /&gt;Sr. RPA Consultant-Automation Developer&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Fri, 20 Aug 2021 14:50:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/How-to-get-count-of-unique-items-in-collection-Scenario/m-p/70224#M22829</guid>
      <dc:creator>Tejaskumar_Darji</dc:creator>
      <dc:date>2021-08-20T14:50:00Z</dc:date>
    </item>
    <item>
      <title>RE: How to get count of unique items in collection - Scenario.</title>
      <link>https://community.blueprism.com/t5/Product-Forum/How-to-get-count-of-unique-items-in-collection-Scenario/m-p/70225#M22830</link>
      <description>Hello Tejas,&lt;BR /&gt;There's some nested looping trickery that's required here.. Basically you want to pick up the value in the first row and loop through the collection and at the same time incrementing a counter as soon as you find a duplicate. Once the loop's done capture the value and the counter in a new collection. Now reset the counter and begin again.&lt;BR /&gt;&lt;BR /&gt;Alternatively, you could also paste that column into an excel and apply some vlookup formulas..&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Harpreet&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Harpreet Kaur Product Consultant&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Mon, 23 Aug 2021 00:35:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/How-to-get-count-of-unique-items-in-collection-Scenario/m-p/70225#M22830</guid>
      <dc:creator>HarpreetKaur</dc:creator>
      <dc:date>2021-08-23T00:35:00Z</dc:date>
    </item>
    <item>
      <title>RE: How to get count of unique items in collection - Scenario.</title>
      <link>https://community.blueprism.com/t5/Product-Forum/How-to-get-count-of-unique-items-in-collection-Scenario/m-p/70226#M22831</link>
      <description>I don't know of any ready-made action to do this but I think it can be achieved with a code stage using Linq.&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;John Carter&lt;BR /&gt;Professional Services&lt;BR /&gt;Blue Prism&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Tue, 24 Aug 2021 14:56:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/How-to-get-count-of-unique-items-in-collection-Scenario/m-p/70226#M22831</guid>
      <dc:creator>John__Carter</dc:creator>
      <dc:date>2021-08-24T14:56:00Z</dc:date>
    </item>
    <item>
      <title>RE: How to get count of unique items in collection - Scenario.</title>
      <link>https://community.blueprism.com/t5/Product-Forum/How-to-get-count-of-unique-items-in-collection-Scenario/m-p/70227#M22832</link>
      <description>Hi Harpreet,&lt;BR /&gt;&lt;BR /&gt;If there are 10,000 records in the column to get count of unique items. can we still use this approach? Does it affect BOT performance?&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;SAI TEJA GAYALA&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Sat, 05 Feb 2022 15:31:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/How-to-get-count-of-unique-items-in-collection-Scenario/m-p/70227#M22832</guid>
      <dc:creator>SAI_TEJAGAYALA</dc:creator>
      <dc:date>2022-02-05T15:31:00Z</dc:date>
    </item>
    <item>
      <title>RE: How to get count of unique items in collection - Scenario.</title>
      <link>https://community.blueprism.com/t5/Product-Forum/How-to-get-count-of-unique-items-in-collection-Scenario/m-p/70228#M22833</link>
      <description>Hi Sai,&lt;BR /&gt;&lt;BR /&gt;For your use case, as John suggested I would go with a custom LINQ query object which you can create easily using below steps.&lt;BR /&gt;&lt;BR /&gt;Firstly, create a business object called '&lt;STRONG&gt;Utility - Collection (LINQ)&lt;/STRONG&gt;' and then add the &lt;STRONG&gt;'External References'&lt;/STRONG&gt; and &lt;STRONG&gt;'Namespace Imports'&lt;/STRONG&gt; in your Initialise action's Page Description stage keeping the language as &lt;STRONG&gt;'Visual Basic'&lt;/STRONG&gt; as shown below:&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="31210.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/31339iF54AE2162EA4EBD1/image-size/large?v=v2&amp;amp;px=999" role="button" title="31210.png" alt="31210.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Create a new action called &lt;STRONG&gt;'Get Element Count'&amp;nbsp;&lt;/STRONG&gt;and add two input parameters named as '&lt;STRONG&gt;Input Collection&lt;/STRONG&gt;' of type '&lt;STRONG&gt;Collection&lt;/STRONG&gt;' and '&lt;STRONG&gt;Field Name&lt;/STRONG&gt;' of type '&lt;STRONG&gt;Text&lt;/STRONG&gt;' and map the data items accordingly. Also, add an output parameter called '&lt;STRONG&gt;Output Collection&lt;/STRONG&gt;' of type '&lt;STRONG&gt;Collection&lt;/STRONG&gt;' and map the data item as well. In addition you need to create a local data item called as '&lt;STRONG&gt;Temp Collection&lt;/STRONG&gt;' of type '&lt;STRONG&gt;Collection&lt;/STRONG&gt;' which has two default columns called '&lt;STRONG&gt;Field&lt;/STRONG&gt;' of '&lt;STRONG&gt;Text&lt;/STRONG&gt;' type and '&lt;STRONG&gt;Count&lt;/STRONG&gt;' of '&lt;STRONG&gt;Number&lt;/STRONG&gt;' type. You can refer the screenshot below:&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="31211.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/31338iDF62B97B67E21E54/image-size/large?v=v2&amp;amp;px=999" role="button" title="31211.png" alt="31211.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Once done add a code stage called &lt;STRONG&gt;'Get Element Count' &lt;/STRONG&gt;and map the input parameters for &lt;STRONG&gt;'Input Collection', 'Field Name'&lt;/STRONG&gt; and &lt;STRONG&gt;'Temp Collection'&lt;/STRONG&gt; along with output parameter as &lt;STRONG&gt;'Output Collection'&lt;/STRONG&gt; to the code stage and add the following code:&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;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()&lt;BR /&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="31212.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/31336i71CDB2F6D93A614B/image-size/large?v=v2&amp;amp;px=999" role="button" title="31212.png" alt="31212.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="31213.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/31337iB0740141EADEECCB/image-size/large?v=v2&amp;amp;px=999" role="button" title="31213.png" alt="31213.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="31214.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/31345i3894900622B010BB/image-size/large?v=v2&amp;amp;px=999" role="button" title="31214.png" alt="31214.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;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:&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="31215.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/31343i0AC8BC16F9DB41BC/image-size/large?v=v2&amp;amp;px=999" role="button" title="31215.png" alt="31215.png" /&gt;&lt;/span&gt;&lt;BR /&gt;Let say I want the count of elements from Field1 so I will set the 'Field Name' input parameter as 'Field1' :&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="31216.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/31341iC9CCFFE823E9C67E/image-size/large?v=v2&amp;amp;px=999" role="button" title="31216.png" alt="31216.png" /&gt;&lt;/span&gt;&lt;BR /&gt;And you can see the results upon code execution:&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="31217.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/31347i285382EE59096159/image-size/large?v=v2&amp;amp;px=999" role="button" title="31217.png" alt="31217.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;​Hope it resolves your query!&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;----------------------------------&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Devneet Mohanty&lt;BR /&gt;Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,&lt;BR /&gt;Wonderbotz India Pvt. Ltd.&lt;BR /&gt;Blue Prism Community MVP | Blue Prism 7x Certified Professional&lt;BR /&gt;Website: &lt;A href="https://devneet.github.io/" target="test_blank"&gt;https://devneet.github.io/&lt;/A&gt;&lt;BR /&gt;Email: devneetmohanty07@gmail.com&lt;BR /&gt;&lt;BR /&gt;----------------------------------&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Sun, 06 Feb 2022 00:17:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/How-to-get-count-of-unique-items-in-collection-Scenario/m-p/70228#M22833</guid>
      <dc:creator>devneetmohanty07</dc:creator>
      <dc:date>2022-02-06T00:17:00Z</dc:date>
    </item>
  </channel>
</rss>

