• 主页

# 怎样得到行数据在分组里的排序号

fallstone 2003-05-07 08:47:10

A B C 名次
ASD 3SD 9 1
ASD 342D 6 2
ASD SD34 3 3

...全文
68 点赞 收藏 22

22 条回复

fallstone 2003-05-09
dibov(迪波威) 说的应该可以

fallstone 2003-05-09
killerdanny(将十一片指甲遗失在故事里) :DW里只有GETROW，GETTEXT啊？

zhzyhq() ：
GetRow() for group 1这个怎么用？有这个用法么？

zhzyhq 2003-05-09

GetRow()-First(GetRow() for group 1)+1 的计算列

fallstone 2003-05-08
OK,我试过了，会在分组里只有一条明细的时候跟上一分组连起来。

dibov 2003-05-08

a:用ll_breakrow = dw_findgroupchange()得到第一组的第一条记录.
b:用count(*) for group 1得到每小组记录数
c: for i = 1 to 每小组记录数
ll_breakrow = ll_breakrow++
//赋给'名次'
next
d:循环
http://expert.csdn.net/Expert/topic/1756/1756957.xml?temp=.4276087

dibov 2003-05-08

killerdanny 2003-05-08

DW一个G开头的函数！

andyzq 2003-05-08

fallstone 2003-05-07
sorry，楼上。

andyzq 2003-05-07

abs(count(A for group 1) - getrow())

andyzq 2003-05-07

1.用A分组
abs(count(A for group 1) - rowcount() - getrow())

2.为表添加一个字段用来记录顺序tag int

long ll_num, ll_num_compare, ll_rowcount, i, ll_find
string ls_A, ls_A_compare

ll_rowcount = dw_1.rowcount()

for i = 1 to ll_rowcount
ls_A = dw_1.object.A[i]
ll_num = dw_1.object.compute_1[i]
if i = 1 then
ls_A_compare = ls_A
ll_num_compare = ll_num
end if

if i < ll_rowcount then
ll_find = dw_1.find("A = '" + ls_A_compare + "'", i + 1, ll_rowcount)
end if

if ll_find > 0 then
dw_1.object.tag[i] = ll_num - ll_num_compare + 1
else
if i > 1 then
dw_1.object.tag[i] = dw_1.object.tag[i - 1] + 1
end if
if i < ll_rowcount then
ls_A_compare = dw_1.object.A[i + 1]
ll_num_compare = dw_1.object.compute_1[i + 1]
end if
end if
next

xirumin 2003-05-07
getrow()不行。
getrow() - 上面各组的和才行

andyzq 2003-05-07

abs(count(A for group 1) - rowcount() - getrow())

andyzq 2003-05-07
sorry,写的不对，再想想

xirumin 2003-05-07

andyzq 2003-05-07

count(A for group 1 DISTINCT)

juwuyi 2003-05-07

fallstone 2003-05-07

mjhnet 2003-05-07

fallstone 2003-05-07
abs(count(A for group 1) - rowcount() - getrow())这句什么意思真不懂

DataWindow

567

PowerBuilder DataWindow