Refresh/Update the View of a Document Saved

Mindwatering Incorporated

Author: Tripp W Black

Created: 11/07/2007 at 10:43 AM

 

Category:
Notes Developer Tips
LotusScript, Views

Issue:


Document is saved but values not updated in view until manual refresh is completed or view is switched. (Refresh icon may or may not display.)


Code to Refresh View after the Document Saved/Closed:


Code to Refresh:
viewrefresh.txt


Code to Refresh Embedded View after Child Document Added and Saved:


Note:
- This solution will updated the embedded view in a parent document, but refresh field values in the parent document.

Child | C form --> QuerySave (event):
Dim w As New NotesUIWorkspace
Dim s As New NotesSession
Dim db As NotesDatabase ' this db
Dim eV As NotesView ' embedded child view

Set db = s.CurrentDatabase
Set eV = db.GetView(“embC”)
Call eV.Refresh
Call w.ViewRefresh


Notes:
- This solution handles refreshing the parent documents computed or editable fields, but it may move tabs around when parent is reopened for edit.
- Assumes child has a field populated on create with the parent's unid: PUNID

Parent | P form --> PostOpen (event):
If Not (source.IsNewDoc) Then
source.EditMode = True
End If

Child | C --> QueryClose (event):
Dim s As New NotesSession
Dim w As New NotesUIWorkspace
Dim db As NotesDatabase
Dim pDoc As NotesDocument ' parent doc
Dim pUIDoc As NotesUIDocument ' parent doc open in edit mode
Dim eV As NotesView ' embedded child view

Set db = s.CurrentDatabase
Set eV = db.GetView(“embC”)
Call eV.Refresh ' force pUIDoc to refresh the embedded view
Call w.CurrentDocument.Refresh ' force pDoc to refresh its UI

Set pDoc = db.GetDocumentByUNID(Source.Document.PUID(0))
Set pUIDoc = w.EditDocument(True, pDoc, False, “”, False, False)

Call w.CurrentDocument.Refresh
Call w.CurrentDocument.GotoField(“P_FieldToRefresh”)
Call w.CurrentDocument.Refresh





previous page

×