首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > PB >

datawindows窗口同类项的统计

2012-03-21 
datawindows窗口同类项的统计求助datawidows里面有selected,id,type字段,我要统计我勾选(selected)的行当

datawindows窗口同类项的统计求助
datawidows里面有 
selected,id,type字段,我要统计我勾选(selected)的行当中type字段的同类合计。如何求解?
比如
1,1,'A'
0,2,'B'
1,3,'A'
1,4,'C'
我勾选好后,点确定给我弹出。A--2次,1--一次,如何做到?

[解决办法]

C# code
Integer i,jString ls_Type[]Integer li_Count[]// 循环处理每一条记录For i = 1 To dw_1.RowCount()    // 如果当前记录被选择,进入统计数量的流程    If dw_1.Object.Selected[i] = 1 Then        // 循环查找当前记录对应的类别        For j = 1 To UpperBound(ls_Type[])            // 如果找到对应类别则退出循环            If ls_Type[j] = dw_1.Object.Type[i] Then                Exit            End If        Next        // 如果没有找到对应类别,说明当前记录是首条该类别的记录,初始化        If j > UpperBound(ls_Type[]) Then            ls_Type[j] = dw_1.Object.Type[i]            li_Count[j] = 0        End If        // 对应类别的数量加1        li_Count[j] = li_Count[j] + 1    End IfNextString ls_Message = ""// 生成显示用信息字符串For j = 1 To UpperBound(ls_Type[])    ls_Message += ls_Type[j] + "--" + String(li_Count[j] + "次~r~n"NextMessageBox("", ls_Message)
[解决办法]
帮顶!!!!!
[解决办法]
C/C++ code
long ll_c, istring ls_type, ls_all = "汇总:"ll_c = long(dw_1.describe("evaluate('count(type for all distinct)', 0)"))for i = 1 to ll_c    //按type升序取type    ls_type = dw_1.describe("evaluate('Small(type, type, " + string(i) + " for all distinct)',0)")    ls_all += '~r~n' + ls_type + " —— " + dw_1.describe("evaluate('sum(if(type = ~"" + ls_type + "~", 1, 0) for all)', 0)") + '次'nextmessagebox('', ls_all) 

热点排行