View Full Version : 数据库中的检索问题,不知道如何设计好
cookie_qq
22-09-06, 08:51 PM
我现在已经有了一个数据库,叫做任务箱。里边有四个视图 分别视在办、待办、在阅、待阅数字统计。都只有一列,分别是处理人的名字。现在我想对每个视图中的每个处理人的在办、待办、在阅、待阅做统计。并且在表单上显示出来,有什么好的设计思路嘛?统计的目的是为了检索用的。在表单上输入在办、待办、在阅、待阅数字,可以搜索出数字大于某个阀值的人,并显示其在办、待办、在阅、待阅的数字。如果不用前面的先做统计的方式还有什么好的方法嘛?我就是为了实现找出数据库中在办、待办、在阅、待阅大于某个数值的人,并显示其各个部分的数字。
applemankt
27-09-06, 10:58 AM
我是这么做的.
Set doc=view.getfirstdocument
Do While Not(doc Is Nothing)
If doc.from(0)<>"" Then
aname=doc.from(0)
'aname=Evaluate("@name([cn];"""+aname+""")")
If namestr="" Or Instr(namestr,aname)<=0 Then
Set collection=view.getalldocumentsbykey(aname,True)
Set doc1=view1.getdocumentbykey(aname,True)
If collection.count>=40 Then
Set doc2=collection.getnthdocument(1)
lasttime=doc2.created
For m=2 To collection.count
Set doc2=collection.getnthdocument(m)
If lasttime<doc2.created Then
lasttime=doc2.created
End If
Next
End If
If (doc1 Is Nothing) And collection.count>=40 Then
Set doc1=New notesdocument(db)
doc1.zuozhe=aname
doc1.form="Sorting"
doc1.total=collection.count
doc1.lasttime=lasttime
Call doc1.save(True,True)
Elseif Not (doc1 Is Nothing) And collection.count>=20 Then
doc1.total=collection.count
doc1.lasttime=lasttime
Call doc1.save(True,True)
End If
If namestr="" Then
namestr=aname
Else
namestr=namestr+","+aname
End If
End If
End If
Set doc=view.getnextdocument(doc)
Loop
End Sub
cookie_qq
06-03-07, 11:57 AM
已经自己做出来了,和你的设计差不多,谢谢了~~
vBulletin® v3.7.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.