Get number of posts to view multiple categories (two categories) using key (Xpages)

I am trying to get a post count to represent multiple categories (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 returned quantity is incorrect. I have over 500 documents. It seems to only return the number of documents (20) of the first subcategory.

I found this mentioned as a bug in the forums. I am running this on server 9.0. Any pointers would be much appreciated.

I would like a total score - categories (25) + documents (500), which I can use in the replay control limit.

Thank,

Dan

+3


source to share


2 answers


I managed to solve this problem using 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


source


Dan. If you can get the count of records into a view column with @AllChildren ... or @AllDecendents or something like that, then with the view navigator you will have to read that value and not actually loop through all the documents.



Another way is to create another view, be hidden and not categorize this second column. Then you original solution should work, I think.

0


source







All Articles