I posted part of this previously but thought I would start a new thread with a more complete code and problem. I am trying to walk through the categories in a NotesViewNavigator and this is the code that I am using. I have stripped it down to pretty much a minimum. The WFSUtils.sysOut just writes a message to the server console. The view has the "Do Not Display Empty categories" checked.
vw.setAutoUpdate(false);
var nav:NotesViewNavigator = vw.createViewNav();
nav.setEntryOptions(NotesViewNavigator.VN_ENTRYOPT_NOCOUNTDATA);
nav.setBufferMaxEntries(400);
nav.setMaxLevel(0);
var rtn:java.util.TreeMap=new java.util.TreeMap();
var entry:NotesViewEntry = nav.getFirst();
var thisCat:java.util.Vector = new java.util.Vector;
try{
while (entry != null){
WFSUtils.sysOut("Entry not null");
thisCat = entry.getColumnValues();
var thisCatString = thisCat.elementAt(0).toString()
WFSUtils.sysOut("thisCat = " + thisCatString);
rtn.put(thisCatString,"Nothing");
WFSUtils.sysOut("did put " + thisCatString)
var tEntry:NotesViewEntry = nav.getNextCategory();
entry.recycle();
entry = tEntry;
tEntry.recycle();
}
viewScope.put("vsCats", rtn.keySet());
}catch(e){
WFSUtils.sysOut("Error in getCategory " + e.toString())
}
When I run this code I get the following in the server console.
25/08/2014 12:55:42 PM HTTP JVM: Entry not null
25/08/2014 12:55:42 PM HTTP JVM: thisCat = Approved~Bill Fox^WFS Automated Back end Process Example
25/08/2014 12:55:42 PM HTTP JVM: did put Approved~Bill Fox^WFS Automated Back end Process Example
25/08/2014 12:55:42 PM HTTP JVM: Error in getCategory Method NotesViewNavigator.getNextCategory(lotus.domino.local.ViewEntry) not found, or illegal parameters
It fails at the getNextCategory(entry) that it is not found or illegal parameter. If I change it to just getNext(entry) the console log shows:
25/08/2014 01:06:48 PM HTTP JVM: Entry not null
25/08/2014 01:06:48 PM HTTP JVM: thisCat = Approved~Bill Fox^WFS Automated Back end Process Example
25/08/2014 01:06:48 PM HTTP JVM: did put Approved~Bill Fox^WFS Automated Back end Process Example
25/08/2014 01:06:48 PM HTTP JVM: Entry not null
25/08/2014 01:06:48 PM HTTP JVM: Error in getCategory Exception occurred calling method NotesViewEntry.getColumnValues()
25/08/2014 01:06:48 PM HTTP JVM: null
So it would appear to me that the var entry is getting messed up somewhere along the line. Interesting is that the getFirst works and my code functions the way I would expect it but neither getNext nor getNextCategory seems to work. Am I missing something in my code or what the getNextCategory should be doing.
TreeSetinstead of aTreeMap. Looks like you don't really need the map. And since the categories in a view are already sorted, you could also just use aList. - Mark Leusink