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"