Using the SQL statement as analogy, lets say you have a view students with columns id, name and otherVar. The column id should be sorted (either in ascending or descending). So the view looks something like this
╔════╦════════════╦═════════════╗
║ id ║ name ║ otherVar ║
╠════╬════════════╬═════════════╣
║ 1 ║ Daniel ║ ---------- ║
║ 2 ║ Joseph ║ ---------- ║
║ 3 ║ Michelle ║ ---------- ║
╚════╩════════════╩═════════════╝
To lookup this view you would write something like this in LotusScript:
Dim session As New NotesSession 'Get current session
Dim currentDB As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim studentId As String
studentId = "<STUDENT_ID>" 'The student ID that needs to be searched
Set currentDB = session.CurrentDatabase 'Get current database
Set view = currentDB.GetView("students") 'Get the view
Set doc = view.GetDocumentByKey(studentId, True) 'Look up the view with student ID to get the student document
Do a simple Google search for NotesView for more information. In formula language you can write it as:
@DbLookup("Notes":"NoCache"; ""; "students"; "<STUDENT_ID>"; "<FIELD TO BE RETRIEVED>"; [FailSilent]);
But formula is less flexible that LotusScript if you want to do complex calculations.