The Refresh method can be used to refresh all fields on the user interface document. When called, fields on the form are recomputed and field values are updated. Bear in mind that this solution may negatively affect the performance of the database and should only be implemented if absolutely necessary. Overall impact to the database will depend on the design, usage, and size of the database. Where possible, it is better to explicitly update other fields on the form when exiting the current field, as opposed to refreshing all fields on the form.
How It Works
All fields on the form are recomputed when the user exits, or "tabs out," of a particular field. The refresh can also be called from a form event such as the QuerySave event. For example, there may be one or more computed fields on the form. After the user selects a value for a field, you may want to refresh other field values or recompute fields.
To implement a form refresh, add the following code to a field or form event.
Sub Exiting(Source As Field) Dim w As NotesUIWorkspace Dim uidoc As NotesUIDocument Set w = new NotesUIWorkspace Set uidoc = w.CurrentDocument Call uidoc.Refresh End Sub
Lotus Notes also provides a form property to automatically refresh fields. All fields on the form are recomputed with each field change. This is achieved by selecting the Automatically refresh fields option on the Form properties dialog window (see Figure 13.6). However, readers should understand that this option can have a detrimental impact to the form's load time and overall performance. Use of this form property should be limitedit should be used only as a last resort.
Figure 13.6. Automatically refresh field option on the Form properties dialog
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
Reference Library Applications
Design Enhancements Using LotusScript
Design Enhancements Using Formula Language
Miscellaneous Enhancements and Tips for Domino Databases
Application Deployment and Maintenance
Appendix A. Online Project Files and Sample Applications
Appendix B. IBM® Lotus® Notes® and Domino®Whats Next?