3
votes

I am trying to retrieve the entries count for a multiple category view (two categories) using a key.

var db:NotesDatabase = session.getDatabase(sessionScope.serverPath,sessionScope.dbName);
var luview = db.getView(sessionScope.viewName);
var vec:NotesViewEntryCollection = null;
if (key != null) {
vec = luview.getAllEntriesByKey(key);
}
count = vec.getCount().toFixed()

The count being returned is incorrect. I have over 500 documents in the view. It seems to be returning just the document count (20) of the first sub-category.

I've found mention of this as a bug in the forums. I'm running this on a 9.0 server. Any pointers would be much appreciated.

What I would like is the total count - categories (25) + documents (500), that I can use in the repeat control limit.

Thanks,

Dan

2

2 Answers

0
votes

I was able to resolve this by using the NotesViewNavigator.

var nav:NotesViewNavigator = v.createViewNavFromCategory(key);
var entry:NotesViewEntry = nav.getFirst();
while (entry != null) { 
count = count + 1;
var tmpentry:NotesViewEntry = nav.getNext(entry);
entry.recycle();
entry = tmpentry;
}
0
votes

Dan - If you can get the entry count into the view column with an @AllChildren... or @AllDecendents or something like that then using the view navigator you should be able to read that value in and not have to actually loop through all the documents.

Another way is to create a different view, could be hidden, and not categorize that second column. Then you're original solution should work I'd think.