Skip to content

Tips on Using Views

Chapter 6-2
Tips on Using Views

Views and HCL C API Programs for Domino and Notes

If you are writing a C API program that can benefit from a particular view of a database, you can define the view to support your C API processing. In fact, this is an excellent reason for creating a view.

You might want your program to read a special subset of the documents in a database. To do this, you can create a view with a selection formula. If you want your program to read a database's documents in a certain order, create a view with the sorting order you want. If you want to read only the main topics in a database, but ignore the response notes, define a view with no response hierarchy.


NSFSearch versus NIFReadEntries

Using a view to select documents for processing by a C API program is very similar to what NSFSearch does. When should you use NSFSearch to find documents in a database, and when should you use a view? Here are some general guidelines.

Use NSFSearch to select documents from a database when:

  • The selection criteria are unknown until run time. In this case, the program must compose the selection formula at run time, compile the formula with NSFFormulaCompile, and pass the formula to NSFSearch. The program cannot use a view, since you must create all views manually before running the program.
  • The performance of the program is not important, or you will run the program only a few times.

    Use a view to select documents from a database when:

    • You want to process the documents in a certain order. You can build this sorting order into the view definition.
    • Performance is important. Often, document selection using a view is faster than the equivalent selection using a compiled formula and NSFSearch.