getPrevSibling (View - Java)

Given a document in a view, returns the document immediately preceding it at the same level. If you use this method on a main document, the preceding main document in the view is returned. If you use it on a response document, the preceding response document with the same parent is returned.

If the view is categorized, the previous sibling is in the same category as the original document.

Defined in



public Document getPrevSibling(Document doc)
    throws NotesException


Document doc

Any document in the view. Cannot be null.

Return value


The document preceding the parameter, at the same level. Returns null if there is no previous sibling in the view.


You can use getPrevSibling to move from one main document to the next, skipping any response documents in between.

If you filtered the view using FTSearch, getPrevSibling returns the previous document in the view, regardless of level.


Two documents are siblings if:

  • They are both main documents, or
  • They are both responses or response-to-responses and share the same parent document.

The first sibling

This method returns null when the parameter is:

  • The first main document in a view
  • The first response (or response-to-response) to a particular parent