<?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 sum rows of a specific column from a collection in Product Forum</title>
    <link>https://community.blueprism.com/t5/Product-Forum/how-to-sum-rows-of-a-specific-column-from-a-collection/m-p/51246#M6337</link>
    <description>You can also use dt.Compute("Sum(FieldName)","") without LinQ. &lt;BR /&gt;Not sure why LinQ is not working for you, but I don't like that field type Of Integer. Number type of collection is decimal.&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Andrey Kudinov&lt;BR /&gt;Project Manager&lt;BR /&gt;MobileTelesystems PJSC&lt;BR /&gt;Europe/Moscow&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
    <pubDate>Thu, 03 Oct 2019 00:05:00 GMT</pubDate>
    <dc:creator>AndreyKudinov</dc:creator>
    <dc:date>2019-10-03T00:05:00Z</dc:date>
    <item>
      <title>how to sum rows of a specific column from a collection</title>
      <link>https://community.blueprism.com/t5/Product-Forum/how-to-sum-rows-of-a-specific-column-from-a-collection/m-p/51245#M6336</link>
      <description>Hello everyone!&lt;BR /&gt;&lt;BR /&gt;I'm trying to get the total amount from a column of a Collection without looping (with Collections of 5000 Rows memory issues could appear). The only way to do this is by using a code stage, but i'm kind of lost on this...&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;For example: A collection with 1200 Rows I want to get the total amount of "X" Column:&lt;BR /&gt;X Column is text type, so each value I have to convert it to integer ...&lt;BR /&gt;&lt;BR /&gt;what i tried was using LinQ with this code that i found on internet;&lt;BR /&gt;
&lt;PRE&gt;Dim total = dt.AsEnumerable().Sum(Function(t) t.Field(Of Integer)("X"));&lt;/PRE&gt;
&lt;DIV class="media" style="overflow: hidden; zoom: 1;"&gt;
&lt;DIV class="media" style="overflow: hidden; zoom: 1;"&gt;The Code Options was this;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="20424.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/20570iB6F2393ED1C00317/image-size/large?v=v2&amp;amp;px=999" role="button" title="20424.png" alt="20424.png" /&gt;&lt;/span&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;When I run the action it throws an error&amp;nbsp;Internal : Exception: Object reference not set to an instance of an object..&lt;BR /&gt;&lt;BR /&gt;I think I'm missing something with the code ( I dont know VB :c ) or the reference but I dont know what.&lt;BR /&gt;&lt;BR /&gt;Is there any better way to accomplish this? What am i doing wrong?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Daniel Sanhueza&lt;BR /&gt;Analyst&lt;BR /&gt;Deloitte&lt;BR /&gt;America/Santiago&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Wed, 02 Oct 2019 17:53:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/how-to-sum-rows-of-a-specific-column-from-a-collection/m-p/51245#M6336</guid>
      <dc:creator>Daniel_Sanhueza</dc:creator>
      <dc:date>2019-10-02T17:53:00Z</dc:date>
    </item>
    <item>
      <title>RE: how to sum rows of a specific column from a collection</title>
      <link>https://community.blueprism.com/t5/Product-Forum/how-to-sum-rows-of-a-specific-column-from-a-collection/m-p/51246#M6337</link>
      <description>You can also use dt.Compute("Sum(FieldName)","") without LinQ. &lt;BR /&gt;Not sure why LinQ is not working for you, but I don't like that field type Of Integer. Number type of collection is decimal.&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Andrey Kudinov&lt;BR /&gt;Project Manager&lt;BR /&gt;MobileTelesystems PJSC&lt;BR /&gt;Europe/Moscow&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Thu, 03 Oct 2019 00:05:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/how-to-sum-rows-of-a-specific-column-from-a-collection/m-p/51246#M6337</guid>
      <dc:creator>AndreyKudinov</dc:creator>
      <dc:date>2019-10-03T00:05:00Z</dc:date>
    </item>
  </channel>
</rss>

