DataTable grouping sum "Up,up,up"

Source: Internet
Author: User

Come on, folks. A simple way to sum a DataTable group

' defines a temporary variable that determines whether a group has been evaluated and
Dim temp= ""
' Sum of values
Dim sumvalue
' cyclic DataTable
For each Dr in mesh part 1. DataTable.Rows
  "according to the length of the current data to which the grouping has been calculated and (before and after the grouping name and" | ", To avoid the grouping of "yes" or "no", this raised group cannot be judged without a sign)
        if (Len (Replace temp, | +dr["group field name"]+ "|", "") =len (temp))
                " to find a grouping and copy it to a variable (here you can set the value somewhere else)
                sumvalue= grid Parts 1. Datatable.compute ("Sum (sum field name)", "Parcel number = '" +dr["group field name"]+ "')
               < Span class= "Apple-converted-space" > 
                temp=temp+ "|" +dr["group field name"]+ "|"
        End If
Next

Original address: http://bbs.delit.cn/thread-533-1-1.html

Reprint please specify the source:

Author: metric Technology www. Delit. cn

DataTable grouping sum "Up,up,up"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.