PDA

View Full Version : 用什么公式统计视图中文档的个数???


xdw076
11-01-07, 04:52 PM
想统计一个视图中文档的个数,不知用什么公式??

请帮忙!!!

sky0321
11-01-07, 08:11 PM
用ls实现,帮助给你看看.具体的可以再查看帮助
EntryCount property
Read-only. The number of documents in a view.
Note This property is new with Release 6.
Defined in
NotesView
Data type
Integer
Syntax
To get: count% = notesView.EntryCount

[ 本帖最后由 sky0321 于 2007-1-11 08:20 PM 编辑 ]

sky0321
11-01-07, 08:29 PM
Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim uiview As NotesUIView
Dim view As NotesView
Dim nav As NotesViewNavigator
Dim entry As NotesViewEntry
Dim msg As String
Set uiview = ws.CurrentView
Set view = uiview.View
If view.EntryCount = 0 Then
Messagebox "No documents in view",,"View empty"
Else
Msgbox view.EntryCount
End If
End Sub

chmy
12-01-07, 01:44 PM
Temp:=@DbColumn("":"NoCache";@Subset(@DbName; 1):"数据库名";"视图名";第几列);
@Elements(Temp)
这样就能知道你的视图里一共有多少文档咯

xdw076
12-01-07, 03:37 PM
非常感谢两位大哥!!!

牛啊!!!我没想到,厉害!!

xdw076
12-01-07, 03:51 PM
我自己写的代理如下,不知哪儿出错,帮忙看看!!

我建了个代理docs,表单中建了个域docs1;在表单的webqueryopen里运行这个代理:

Sub Initialize
Dim session As NotesSession
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument

Dim n As Integer
Set db=session.CurrentDatabase

Set doc=session.DocumentContext
Set collection=db.AllDocuments
n = collection.Count
doc.docs1=n

Call doc.Save( False, True )
End Sub
帮忙看看是哪儿出错??

错误显示:agent "docs" error:object variable not set

zhiweiou
12-01-07, 05:12 PM
doc.docs1=n
改成 doc.docs1=cstr(n)

document
15-01-07, 11:37 AM
db.alldocuments 包含了簡要表(profile), 因此你得到的結果肯定要比你預期的結果要多

chmy
15-01-07, 03:17 PM
原帖由 xdw076 于 2007-1-12 03:51 PM 发表
我自己写的代理如下,不知哪儿出错,帮忙看看!!

我建了个代理docs,表单中建了个域docs1;在表单的webqueryopen里运行这个代理:

Sub Initialize
Dim session As NotesSession
Dim db As NotesDatabase
...
大哥~~~是Dim session As NEW NotesSession呀.这个问题也要拿出来说吗???~~~~~
厉害拉~~~~

xdw076
16-01-07, 10:25 AM
:L 竟然把这个给忘了!!!!

db.alldocuments 包含了簡要表(profile), 因此你得到的結果肯定要比你預期的結果要多
=======================================================================

请教:db.alldocuments 应该如何才能得到数据库中正确的文档数量???

chmy
16-01-07, 10:42 AM
你要想用LS得到确定的数据库的文档数的话,做个视图,选择的是select @all这样这个视图就是全部的文档数,然后DB.GETVIEW("ALL")然后在GETFISTDOCUMENT,然后循环,循环里做个计数器,然后在GETNEXTDOCUMENT