Xpages - 调用方法时发生异常NotesView.getNextDocument(lotus.domino.local.Document)null

时间:2016-12-01 11:40:52

标签: xpages lotus-notes lotus-domino xpages-ssjs ssjs

我收到了上述错误。 有没有办法可以检查下一个文件是否为空? 以下是我的代码:

var vec:NotesView = database.getView("QueryNotes");
var queryColl:NotesDocumentCollection =   vec.getAllDocumentsByKey(ProjectUNID,true);
if(queryColl.getCount() > 0){
var queryDoc1:NotesDocument = queryColl.getFirstDocument();
while (queryDoc1 != null) {
    if(!queryDoc1.hasItem("QueryEndDate")){
        queryDoc1.appendItemValue("QueryEndDate", session.createDateTime(@Now()));

        var tmpdoc = vec.getNextDocument(queryDoc1); //error when next is null, or does not exist
        queryDoc1.recycle();
        queryDoc1 = tmpdoc;
      }
   }
}

应该有一种检查方法,stackoverflow上的类似question没有回答这个问题。

期待您的回复。

1 个答案:

答案 0 :(得分:3)

您正在vec变量(它是一个视图对象,并且没有该方法)上调用getNextDocument()。您应该使用queryColl变量。