版主,以下是选两条记录进行合并,反复测试黄色不对。Netweiht_Total 是通过表属性中表达式得出来的。它不让进行合并。
因为两条记录中的Netweight_PC 是不相同的,合并后想让Netweiht_Total 加总后再除以加总的数量,再得出一个Netweight_PC ,不知道如何修改,请帮忙一下,谢谢。
Dim t As Table = Tables("Shipment.customsinvoice")
Dim cr = t.Rows(t.BottomPosition )
For i As Integer = t.BottomPosition-1 To t.TopPosition Step -1
If cr("ShippingNO") = t.Rows(i)("ShippingNO") AndAlso cr("NameinChinese") = t.Rows(i)("NameinChinese") AndAlso cr("Unit") = t.Rows(i)("unit") AndAlso cr("HS") = t.Rows(i)("HS")
cr("Qty") += val(t.Rows(i)("Qty"))
cr("TotalPrice") += val(t.Rows(i)("TotalPrice"))
cr("PO_UnitPrice") += val(t.Rows(i)("TotalPrice"))/val(t.Rows(i)("Qty"))
cr("GrossWeight_total") += val(t.Rows(i)("GrossWeight_Total"))
cr("Netweight_Total") += val(t.Rows(i)("Netweight_Total"))
cr("Netweight_PC") = cr("Netweight_total") /cr("Qty")
t.Rows(i).delete
Else
cr = t.Rows(i)
End If
Next