以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 按日期统计个数 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=132588) |
||||
-- 作者:ZJZK2018 -- 发布时间:2019/3/25 15:54:00 -- 按日期统计个数 需求: 根据表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
[此贴子已经被作者于2019/3/25 15:56:09编辑过]
|
||||
-- 作者:有点甜 -- 发布时间:2019/3/25 16:14:00 -- For Each c As String In lst ndr(c) = tb.Compute("Count([风险控制价])","风险控制价 >=" & i/100 & " And 风险控制价 < " & (i+0.15)/100 & "and convert(开标日期,\'System.String\') like \'%" & c & "%\'" ) Next |