Domino Code Fragment

Code Name*
Use the backend class to manipulate the data exchange between a dialog box and the underlying document.
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.144.42.196
Description*
When NotesUIWorkspaceDialogBox brings up a dialog box, the backend class is always there whether or not the underlying document is saved to the disk or not. When you click OK on the dialog box, the Querysave event will not be called, but the Queryclose event is called. For example, you want to do some calculations based on user's input and passed the result to the underlying document or determine which field not to pass. You can use [ noNewFields ] , [ noFieldUpdate ] to accomplish this to a certain degree, but here a way to mix saved and unsaved items. This function performs SomeComplicatedCalculation( ) on the item "Year" and then removes it so it is not passed back to the document. In this example, year is set as a default value on the underlying document and may be changed in the dialog box; however, when the dialog box is saved the original default shouldn't be modified.
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
Sub Queryclose(Source As Notesuidocument, Continue As Variant)
     Dim doc as NotesDocument
     dim iYear as integer
     dim item as NotesItem
     set doc = Source.Document
     iYear = doc.Document.Year(0)
     FieldToPass = SomeComplicatedCalculation(iYear)
   
      'Don't want to pass Year field,  so remove it
    Set item = doc.GetFirstItem( "Year" )
    item.Remove
End Sub