Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Lotus notes Lotus notes-从LotusScript访问首次使用时共享私有视图时出错_Lotus Notes_Lotusscript - Fatal编程技术网

Lotus notes Lotus notes-从LotusScript访问首次使用时共享私有视图时出错

Lotus notes Lotus notes-从LotusScript访问首次使用时共享私有视图时出错,lotus-notes,lotusscript,Lotus Notes,Lotusscript,早上好 我开发了一个Notes应用程序,用于预订。此应用程序由多个用户同时使用。 我对这个开发还不熟悉,现在我想开发一个功能,这样用户就可以将导出数据打印到excel 我创建了一个视图(共享),其中它的选择公式基于每个用户在搜索表单中指定的关键值。当一个用户正在打印但尚未完成时,我遇到了问题,其他用户也在同时单击打印,导出侧面数据的结果与第一个创建的用户相同 我被认为可能正在使用这种(共享的、首次使用时私有的视图),但它在我调用的地方生成了一个错误[Notes error:Index不是在服务器

早上好

我开发了一个Notes应用程序,用于预订。此应用程序由多个用户同时使用。 我对这个开发还不熟悉,现在我想开发一个功能,这样用户就可以将导出数据打印到excel

我创建了一个视图(共享),其中它的选择公式基于每个用户在搜索表单中指定的关键值。当一个用户正在打印但尚未完成时,我遇到了问题,其他用户也在同时单击打印,导出侧面数据的结果与第一个创建的用户相同

我被认为可能正在使用这种(共享的、首次使用时私有的视图),但它在我调用的地方生成了一个错误[Notes error:Index不是在服务器上生成的(“视图名”)]

我不知道如何解决这个问题。你能告诉我如何解决这个问题吗

提前感谢您的大力帮助

致以最良好的祝愿


Veasna有不同的方法来实现这一点。一种可能性是使用一个“共享的、第一次使用时私有的”(spofu)视图:然后每个用户都会获得自己的视图副本,并且它们不会相互影响。但我认为这样做不是一个好主意,因为每个用户都需要设计师的权限来更改视图的选择公式。这是你不想要的

更好的方法是为每个用户使用spofu文件夹,并将文档按如下方式放入其中:

Dim ses as New NotesSession   
Dim db as NotesDatabase
Dim dc as NotesDocumentCollection
Dim folder As NotesView
Dim formula as String

Set db = ses.currentDatabase
Set folder = db.GetView("NameOfTheSpofuFolder" )
'Make it empty
Call folder.AllEntries.RemoveFromFolder("NameOfTheSpofuFolder")
'Search documents based on the formula
Formula = "Field1 = 2 & Field2 = 5"
Set dc = db.Search( formula, Nothing, 0)
Call dc.PutInFolder("NameOfTheSpofuFolder")
Spofu文件夹需要一点“小心”,但通常它们工作得很好


这段代码没有经过测试,只是在没有语法检查的情况下写下来。它可能包含拼写错误,但应该能让您知道如何开始。

您可以创建一个Lotusscript代理来导出用户指定的数据。 从表单中获取搜索条件,然后使用db.search或(最好)db.FTSearch获取要导出的文档。 现在,您可以使用此处介绍的技术之一将这些文档的数据导出到Excel:

如果要导出为CSV,可以使用此代码作为开始:

根据,可能有解决此问题的方法。您没有显示足够的代码来确定。如果您使用
getView()
访问第一次使用时共享-私有(SPOFU)视图,则该操作无效。解决方法是循环使用
db.Views()
数组,同时检查
Name
Readers
属性,以确保获得视图的私有实例而不是共享实例的句柄

Dim ses as New NotesSession   
Dim db as NotesDatabase
Dim dc as NotesDocumentCollection
Dim folder As NotesView
Dim formula as String

Set db = ses.currentDatabase
Set folder = db.GetView("NameOfTheSpofuFolder" )
'Make it empty
Call folder.AllEntries.RemoveFromFolder("NameOfTheSpofuFolder")
'Search documents based on the formula
Formula = "Field1 = 2 & Field2 = 5"
Set dc = db.Search( formula, Nothing, 0)
Call dc.PutInFolder("NameOfTheSpofuFolder")