【发布时间】:2020-06-19 03:39:53
【问题描述】:
我正在执行一个 while 循环来获取分类视图中的记录。 我只想返回满足 if 条件的第一条记录,而不是整个类别。 下面的代码返回类别中通过'if'条件的所有记录。
var vView:NotesView = database.getView("Document");
var doc:NotesDocument = vView.getFirstDocument();
while(doc != null){
if(doc.getItemValueString("Status") == 'Live'){
//get the first in the category here where condition is met
var pVersion = doc.getItemValueString("Version");
var pPro = doc.getItemValueString("Pro");
}
var tmpDoc:NotesDocument = vView.getNextDocument(doc);
doc.recycle();
doc = tmpDoc;
}
在下面查看:
箭头显示我想要返回的记录。
【问题讨论】:
-
我认为您的代码非常无效。相应地计划。根据您的条件创建一个包含类别的视图。然后使用 NotesViewNavigator,只遍历类别,得到每个类别的第一个文档。
标签: xpages lotus-notes lotus-domino xpages-ssjs domino-designer-eclipse