This routine illustrates how to retrieve all views associated with a database and could be used to build custom buttons that retrieve data based on a selected view.
How It Works
Using the NotesDatabase and NotesView classes, the routine iterates through all views in a database and displays a message to the user.
Implementation
In the following example, all database views (hidden or otherwise) will be processed with the name of each view appended to a string and displayed in a message window. Alternatively, you may want to store the view names in a dynamic array or perform some other data query for each view. To implement this technique, create an action button. Set the Language Selector to LotusScript and insert the following statements in the Programmer's pane.
Sub Click(Source As Button) '----------------------------------------------------------------- ' Define the objects '----------------------------------------------------------------- Dim s As NotesSession Dim db As NotesDatabase Dim view As NotesView Dim strViewTitles As String Set s = New NotesSession Set db = s.CurrentDatabase '----------------------------------------------------------------- ' Display all view names for the database '----------------------------------------------------------------- If Not Isempty (db.Views) Then Forall v In db.Views strViewTitles = strViewTitles & Chr$(10) & v.Name End Forall Msgbox (strViewTitles) End If End Sub
An Introduction to the Lotus Domino Tool Suite
Getting Started with Designer
Navigating the Domino Designer Workspace
Domino Design Elements
An Introduction to Formula Language
An Introduction to LotusScript
Fundamentals of a Notes Application
Calendar Applications
Collaborative Applications
Reference Library Applications
Workflow Applications
Web Applications
Design Enhancements Using LotusScript
Design Enhancements Using Formula Language
View Enhancements
Sample Agents
Miscellaneous Enhancements and Tips for Domino Databases
Data Management
Security
Application Deployment and Maintenance
Troubleshooting
Appendix A. Online Project Files and Sample Applications
Appendix B. IBM® Lotus® Notes® and Domino®Whats Next?