获取视图中的第N个文档

mwymenghuan 2010-11-25 10:17:02
Set vw = db.GetView("InfoPublishedByDate_View")
Set docTarget = vw.GetNthDocument(10)

为什么这样获取不到.请问下应该怎么获取.在线等```
...全文
92 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
haster 2010-12-16
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 honggulianhua 的回复:]
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim entry As NotesViewEntry
Dim vc As NotesViewEntryCollection
Dim doc As NotesDocument
Set db = session.CurrentData……
[/Quote]
这样做最好把视图的自动刷新停止
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim entry As NotesViewEntry
Dim vc As NotesViewEntryCollection
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Set view = db.getView("By Category")
view.AutoUpdate = false
Set vc = view.GetAllEntriesByKey("Student")
Set entry = vc.GetNthEntry(3)
Set doc = entry.Document
此种方法如果视图是分类视图,如果条目是分类的话,则取不到document。
HongGuLianHua 2010-12-12
  • 打赏
  • 举报
回复
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim entry As NotesViewEntry
Dim vc As NotesViewEntryCollection
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Set view = db.getView("By Category")
Set vc = view.GetAllEntriesByKey("Student")
Set entry = vc.GetNthEntry(3)
Set doc = entry.Document

五楼正解。这个要常用,如果视图使用比较频繁,建议常用entry而非dc 效率会快很多,特别是在文档有附件的情况下。
apexx 2010-12-10
  • 打赏
  • 举报
回复
5楼正解,只要不刷新view就没问题
gz_pc 2010-12-09
  • 打赏
  • 举报
回复
使用dc不行,会存在乱的情况
风影极光 2010-11-25
  • 打赏
  • 举报
回复
我想您的方法不对。你应该先得到一个文档集合,然后进行定位,并判断处于位置10的文档是否存在。
语法如下:
Syntax
Set notesDocument = notesDocumentCollection.GetNthDocument( n% )
实例代码:
Dim session As New NotesSession
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Set db = session.CurrentDatabase
Set collection = db.AllDocuments
Set doc = collection.GetNthDocument( 3 )
非凡笨笨 2010-11-25
  • 打赏
  • 举报
回复
使用dc不行,会存在乱的情况,可以考虑考虑用如下方法:

Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim entry As NotesViewEntry
Dim vc As NotesViewEntryCollection
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Set view = db.getView("By Category")
Set vc = view.GetAllEntriesByKey("Student")
Set entry = vc.GetNthEntry(3)
Set doc = entry.Document
yinkehao 2010-11-25
  • 打赏
  • 举报
回复
使用文档集是不行的,view取文档集后的排序就乱了
lotusriver2008 2010-11-25
  • 打赏
  • 举报
回复
不好意思,刚才记混了。文档从1开始。
Set docTarget = vw.GetNthDocument(10)取不到文档,有两种可能性,
1. 文档数目确实不足。
2. 该视图是分类视图。
出现第一种情况lz自然能解决,第二种情况你可把视图第一列的分类属性去掉就能查出来了。
lotusriver2008 2010-11-25
  • 打赏
  • 举报
回复
[Quote=引用楼主 mwymenghuan 的回复:]
Set vw = db.GetView("InfoPublishedByDate_View")
Set docTarget = vw.GetNthDocument(10)

为什么这样获取不到.请问下应该怎么获取.在线等```
[/Quote]
这种写法是没问题的。取不到是不是因为你的文档没有这么多?文档时从0开始编号,vw.GetNthDocument(10)是去这张视图的第11条文档。

535

社区成员

发帖
与我相关
我的任务
社区描述
企业开发 Exchange Server
社区管理员
  • 消息协作社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧