Xpages: view = database.getView() does not work

in a server side script, I cannot use —

view = database.getView(…)

doc = view.getDocumentByKey(…)


I get an Interpreter exception.

But this works:


doc = database.getView(…).getDocumentByKey(…)


Looks like a bug to me :slight_smile:

Subject: re xpages: view = database.getView() does not work

There is an error in your JavaScript code.

The line

 view = database.getView(...)

will attempt to assign a NotesView object to the XPage view - i.e. the XPage server side representation of your page and the hierarchy of components in it.

“view” is a global reserved keyword for the XPage view.

So what you want to do is this (i.e. assign the Notes view to a NotesView object)

var notesView:NotesView = database.getView(“Xxx”);
var doc:NotesDocument = notesView.getDocumentByKey(“Yyy”);
return doc.getItemValueString(“title”);

Subject: aha! thanks a lot!