Domino Code Fragment

Code Name*
Retrieve the name of the Default View in a Database using the NotesView property, IsDefaultView.
Date*
04/29/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.144.238.20
Description*
It is possible to retrieve the name of the default view in a database using the NotesView property, IsDefaultView . Since IsDefaultView is a property of each individual view in the database, it is necessary to test each view in a database until the default view is found.
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
It is possible to retrieve the name of the default view in a database using the NotesView property, IsDefaultView. Since IsDefaultView is a property of each individual view in the database, it is necessary to test each view in a database until the default view is found. Remember that only one view can be set to default, so that when the default view is found you can stop processing views. This can be done by using the NotesDatabase property, Views. Views allows access to all of the views and their properties in a database. By using a ForAll statement, you can test each view.

Click here to view the example.

Dim session As New NotesSession 'Declare session as a new Notes session
Dim db As NotesDatabase
'Declare db as a Notes Database
Set db = session.CurrentDatabase
'Set db to the current Notes database (open)
Forall x In db.Views
'Use ForAll to loop through each view in the database until the default is found
If x.IsDefaultView Then
'Test each view to see if it is the default view
Messagebox x.name & " is the default view of this database."
'If the view is the default, display a message
Exit Forall
'Once the default view is found, break out of the loop
End If
End Forall