Below are two blocks of code in the beforePageLoad event of the XPage. Assume that the variables are declared earlier. Here's the essence of the problem. I have labeled the blocks 1 and 2. Block 1 executes just fine but Block 2 does not. If I reverse the order, Block 2 executes but Block 1 does not. There does not seem to be anything wrong with the individual blocks but running them one after the other seems to be an issue. My complete code is surrounded by a try catch block - no errors received.
I would love to know what I am doing wrong.
Thanks,
Dan
// BLOCK 1 - Get total no of guests on the voyage
var dbTraveler:NotesDatabase = session.getDatabase(null,
viewScope.pathDbGuests, false );
var viewTraveler:NotesView = dbTraveler.getView( "(vwGuestInfoByVoyage)" );
if (viewTraveler != null){
var nav:NotesViewNavigator = viewTraveler.createViewNav();
var entry:NotesViewEntry = nav.getFirst();
while (entry != null && !entry.isTotal()) {
if (entry.getColumnValues().firstElement().toString() == viewScope.voyage){
viewScope.cat = entry.getColumnValues().firstElement().toString();
viewScope.voyageGuestCount = entry.getChildCount().toFixed() ;
sessionScope.voyageGuestCount = viewScope.voyageGuestCount;
}else{
var tmpentry:NotesViewEntry = nav.getNextSibling(entry);
}
entry.recycle();
entry = tmpentry;
}
}
viewTraveler.recycle();
viewTraveler = null;
// Block 2 - Load pre-post travel details into an array
if(@Trim(@Left(sessionScope.DebarkEmbark,"@")) == "Embark"){
var viewpreTravel:NotesView = dbTravel.getView("luPreCruiseFlight");
if (viewpreTravel == null){//do nothing
viewScope.preTravelView = "luPreCruiseFlight View not found"
}else{
viewScope.preTravelView = "luPreCruiseFlight View found"
}
}else{
var viewpostTravel:NotesView = dbTravel.getView( "luPostCruiseFlight" );
if (viewpostTravel == null){//do nothing
viewScope.postTravelView = "luPostCruiseFlight View not found"
}else{
viewScope.postTravelView = "luPostCruiseFlight View found"
}
}
viewpreTravel.recycle();
viewpreTravel = null;
viewpostTravel.recycle();
viewpostTravel = null;
You only go to the next view entry in the else block in code block 1.