需求:
根据表C中数据,统计按年月统计出各个数据?下面红色代码不起作用,如何调整?谢谢
Dim tb As Table = Tables("表C")
Dim tb1 As Table = Tables(e.Form.Name & "_Table1")
'----生成临时统计表------
Dim dtb As New DataTableBuilder("统计表11")
dtb.AddDef("下浮点",Gettype(Decimal))
dtb.AddDef("个数",Gettype(Double))
Dim lst As New List(Of String)
For Each cr As Row In tb.Rows
If cr.IsNull("开标日期") = False Then
Dim st As String = Format(cr("开标日期"),"yyyy-MM")
If lst.Contains(st) = False Then
lst.Add(st)
End If
End If
Next
'Dim str = String.Join("|",lst.ToArray)
For Each v As String In lst
dtb.AddDef(v, Gettype(String))
Next
dtb.Build(True)
tb1.DataSource = dtb.BuildDataSource
Dim ndr As Row
For i As Decimal = -2 To 1 Step 0.15
ndr = tb1.AddNew()
ndr("下浮点") = i
If i < 0 Then
ndr("个数") = tb.Compute("Count([开标日期])","风险控制价 >=" & i/100 & " And 风险控制价 < " & (i+0.15)/100)
ElseIf i > 0 Then
ndr("个数") = tb.Compute("Count([开标日期])","风险控制价 >" & (i-0.15)/100 & " And 风险控制价 <= " & i/100)
Else
ndr("个数") = tb.Compute("Count([开标日期])","风险控制价 = 0")
End If
ndr("2018-11") = tb.Compute("Count([风险控制价])","风险控制价 >=" & i/100 & " And 风险控制价 < " & (i+0.15)/100 & "and 开标日期 like '%2018-11%'" )
各日期列如:2018-12,2019-01等等
Next
此主题相关图片如下:6666.png
[此贴子已经被作者于2019/3/25 15:56:09编辑过]