<?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: Unique Items in a collection in Product Forum</title>
    <link>https://community.blueprism.com/t5/Product-Forum/Unique-Items-in-a-collection/m-p/57114#M11178</link>
    <description>Try this:&lt;BR /&gt;&lt;CODE&gt;DataView v = new DataView(Collection_In);
Collection_Out = v.ToTable(true, Column_Name_CSV.Split(','));​&lt;/CODE&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Ami Barrett&lt;BR /&gt;Sr Product Consultant&lt;BR /&gt;Blue Prism&lt;BR /&gt;Plano, TX&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
    <pubDate>Wed, 21 Oct 2020 14:22:00 GMT</pubDate>
    <dc:creator>AmiBarrett</dc:creator>
    <dc:date>2020-10-21T14:22:00Z</dc:date>
    <item>
      <title>Unique Items in a collection</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Unique-Items-in-a-collection/m-p/57107#M11171</link>
      <description>&lt;P&gt;Does anyone have an existing activity or some VB code I can use to filter a collection to only include unique items?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Oliver Mohajeri&lt;BR /&gt;Consultant&lt;BR /&gt;EY&lt;BR /&gt;Europe/Zurich&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Thu, 13 Jun 2019 15:57:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Unique-Items-in-a-collection/m-p/57107#M11171</guid>
      <dc:creator>OliverMohajeri</dc:creator>
      <dc:date>2019-06-13T15:57:00Z</dc:date>
    </item>
    <item>
      <title>RE: Unique Items in a collection</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Unique-Items-in-a-collection/m-p/57108#M11172</link>
      <description>Hi, to get some unique values You can loop through the collection and for each value filter the collection to find values that occur only once, then just copy the value to the new collection with unique values.&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Ł&amp;#129;ukasz Janiak&lt;BR /&gt;RPA Developer&lt;BR /&gt;Nordea&lt;BR /&gt;Europe/Łódź&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Fri, 14 Jun 2019 09:01:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Unique-Items-in-a-collection/m-p/57108#M11172</guid>
      <dc:creator>lukasz.janiak</dc:creator>
      <dc:date>2019-06-14T09:01:00Z</dc:date>
    </item>
    <item>
      <title>RE: Unique Items in a collection</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Unique-Items-in-a-collection/m-p/57109#M11173</link>
      <description>Hi Oliver,&lt;BR /&gt;&lt;BR /&gt;I made an action in BP that does not use any custom code stage, but it's a bit convoluted because I have it accounting for any collection of any number of fields and gives the choice to deduplicate based on one or more fields. This kind of manipulation is likely better in code as you mentioned. But, to solve at least your use case, it's not very difficult to do in BP.&lt;BR /&gt;First, I'll assume you're trying to filter a collection for unique values in a single field. The most efficient way that I am aware of is to first use Sort Collection on the field you are focusing on. Then, use Loop stages to loop through the collection. Also, create two data items: Current Value and Previous Value. &lt;BR /&gt;Here's the flow or at least this is something like what you'd go for.: (Collection1 is your main collection and Collection2 is what you're copying unique values to)&lt;BR /&gt;Sort Collection1 on your field so that equal values are next to each other alphanumerically.&lt;BR /&gt;Loop Start&lt;BR /&gt;Get the current value of the field and store it in 'Current Value'&lt;BR /&gt;Decision stage: [Current Value]=[Previous Value]. (FYI: the first time through the loop it will compare the current value to empty text -- if this is a text datatype)&lt;BR /&gt;&amp;nbsp; If Yes, Go to the Loop End&lt;BR /&gt;&amp;nbsp; If No, add a new row to Collection2 and store the current row in Collection1 into the new row in Collection2&lt;BR /&gt;&amp;nbsp; (still under If No) Also set the value in [Current Value] into [Previous Value]&lt;BR /&gt;Loop End&lt;BR /&gt;&lt;BR /&gt;If you are trying to compare the entire row, there are a couple ways to do this. You can compare entire collections like [CollectionA]=[CollectionB] so you'd probably copy rows out into temporary, single row collections to compare them to each other. Otherwise, depending on the datatypes of your fields, you could compare a concatenation of all the fields, like [CollectionA.Field1] &amp;amp; [CollectionA.Field2] =&amp;nbsp;[CollectionB.Field1] &amp;amp; [CollectionB.Field2].&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Dave Morris&lt;BR /&gt;3Ci @ Southern Company&lt;BR /&gt;Atlanta, GA&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Fri, 14 Jun 2019 12:01:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Unique-Items-in-a-collection/m-p/57109#M11173</guid>
      <dc:creator>david.l.morris</dc:creator>
      <dc:date>2019-06-14T12:01:00Z</dc:date>
    </item>
    <item>
      <title>RE: Unique Items in a collection</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Unique-Items-in-a-collection/m-p/57110#M11174</link>
      <description>&lt;P&gt;Here's some C# code I wrote to pull distincts. Should be easy enough to convert back to VB.&lt;BR /&gt;&lt;BR /&gt;Inputs:&lt;BR /&gt;Collection - Collection&lt;BR /&gt;Column - Text&lt;/P&gt;
&lt;P&gt;Outputs:&lt;BR /&gt;Sorted Collection - Collection&lt;/P&gt;
&lt;PRE class="language-csharp"&gt;DataView dv &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; Collection&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;DefaultView&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
Sorted_Collection &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; dv&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;ToTable&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token keyword"&gt;true&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; Column&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Ami Barrett&lt;BR /&gt;Lead RPA Software Developer&lt;BR /&gt;Solai &amp;amp; Cameron&lt;BR /&gt;America/Chicago&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Fri, 14 Jun 2019 14:29:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Unique-Items-in-a-collection/m-p/57110#M11174</guid>
      <dc:creator>AmiBarrett</dc:creator>
      <dc:date>2019-06-14T14:29:00Z</dc:date>
    </item>
    <item>
      <title>RE: Unique Items in a collection</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Unique-Items-in-a-collection/m-p/57111#M11175</link>
      <description>Hi Oliver,&lt;BR /&gt;&lt;BR /&gt;As previously mentioned, it's relatively trivial to create an object to loop through the input collection to retrieve unique values. I've included an action I created for this very purpose though I wouldn't suggest using this on large collections.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Oliver Ong&lt;BR /&gt;Consultant&lt;BR /&gt;Ernst &amp;amp; Young LLP&lt;BR /&gt;America/Edmonton&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Mon, 17 Jun 2019 21:05:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Unique-Items-in-a-collection/m-p/57111#M11175</guid>
      <dc:creator>OliverOng</dc:creator>
      <dc:date>2019-06-17T21:05:00Z</dc:date>
    </item>
    <item>
      <title>RE: Unique Items in a collection</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Unique-Items-in-a-collection/m-p/57112#M11176</link>
      <description>To expand on Amy's suggestion, you can specify which columns you want as unique, like this.&lt;BR /&gt;&lt;BR /&gt; Dim v As New DataView(Collection_In) &lt;BR /&gt;Collection_Out = v.ToTable(true, Column_Name_CSV.Split(","))&lt;BR /&gt;&lt;BR /&gt;Note however that the output collection will only contain the columns you have specified, so this may not be exactly what you're after.&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;John Carter&lt;BR /&gt;Professional Services&lt;BR /&gt;Blue Prism&lt;BR /&gt;Europe/London&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Fri, 21 Jun 2019 10:33:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Unique-Items-in-a-collection/m-p/57112#M11176</guid>
      <dc:creator>John__Carter</dc:creator>
      <dc:date>2019-06-21T10:33:00Z</dc:date>
    </item>
    <item>
      <title>RE: Unique Items in a collection</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Unique-Items-in-a-collection/m-p/57113#M11177</link>
      <description>Hi John,&lt;BR /&gt;This works well with VB but When I change the code to C# , I am getting compile error with the Split function. Can you please assist with the corresponding C# solution?&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Kirtish Trivedi&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Wed, 21 Oct 2020 14:04:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Unique-Items-in-a-collection/m-p/57113#M11177</guid>
      <dc:creator>kirtish.trivedi</dc:creator>
      <dc:date>2020-10-21T14:04:00Z</dc:date>
    </item>
    <item>
      <title>RE: Unique Items in a collection</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Unique-Items-in-a-collection/m-p/57114#M11178</link>
      <description>Try this:&lt;BR /&gt;&lt;CODE&gt;DataView v = new DataView(Collection_In);
Collection_Out = v.ToTable(true, Column_Name_CSV.Split(','));​&lt;/CODE&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Ami Barrett&lt;BR /&gt;Sr Product Consultant&lt;BR /&gt;Blue Prism&lt;BR /&gt;Plano, TX&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Wed, 21 Oct 2020 14:22:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Unique-Items-in-a-collection/m-p/57114#M11178</guid>
      <dc:creator>AmiBarrett</dc:creator>
      <dc:date>2020-10-21T14:22:00Z</dc:date>
    </item>
    <item>
      <title>RE: Unique Items in a collection</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Unique-Items-in-a-collection/m-p/57115#M11179</link>
      <description>Thanks for the code &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Nilesh Jadhav &lt;BR /&gt;Senior RPA Specialist&lt;BR /&gt;ADP&lt;BR /&gt;India&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Fri, 30 Oct 2020 15:05:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Unique-Items-in-a-collection/m-p/57115#M11179</guid>
      <dc:creator>NileshJadhavBP</dc:creator>
      <dc:date>2020-10-30T15:05:00Z</dc:date>
    </item>
  </channel>
</rss>

