此主题相关图片如下:11.jpg
代码如下:
设置的是DataColChanged某一列的内容被更改后执行,此时列的内容已经是更改后的值。
If e.DataCol.Name = "日期" Then
e.DataRow("消费") = DataTables("消费表").Compute("sum(朋友圈_消费)","[日期] = '" & e.NewValue & "'")
e.DataRow("总询盘") = DataTables("询盘表").Compute("count(编号)","[询盘日期] = '" & e.NewValue & "' AND [询盘来源] = '朋友圈'")
e.DataRow("有效") = DataTables("询盘表").Compute("count(有效否)","[询盘日期] = '" & e.NewValue & "' AND [询盘来源] = '朋友圈' AND [有效否] = '有'")
e.DataRow("无效") = DataTables("询盘表").Compute("count(有效否)","[询盘日期] = '" & e.NewValue & "' AND [询盘来源] = '朋友圈' AND [有效否] = '无'")
e.DataRow("待定") = DataTables("询盘表").Compute("count(有效否)","[询盘日期] = '" & e.NewValue & "' AND [询盘来源] = '朋友圈' AND [有效否] = '待定'")
e.DataRow("有效率") = DataTables("朋友圈日报").Compute("sum(有效)","[日期] = '" & e.NewValue & "'") / DataTables("朋友圈日报").Compute("sum(总询盘)","[日期] = '" & e.NewValue & "'")
e.DataRow("录入成本") = DataTables("朋友圈日报").Compute("sum(消费)","[日期] = '" & e.NewValue & "'") / DataTables("朋友圈日报").Compute("sum(总询盘)","[日期] = '" & e.NewValue & "'")
e.DataRow("有效成本") = DataTables("朋友圈日报").Compute("sum(消费)","[日期] = '" & e.NewValue & "'") / DataTables("朋友圈日报").Compute("sum(有效)","[日期] = '" & e.NewValue & "'")
End If