Manage Learn to apply best practices and optimize your operations.

View and open documents from another database

View and open documents from another database.

This button allows you to get a view from Database2 and open its documents from a document in Database 1.

Action button in a document in Database1:

Sub Click(Source As Button)
Dim wK As New NotesUIWorkSpace
Dim S As New NotesSession
Dim doc As NotesDocument, Doc90 As NotesDocument
Dim UIDoc As NotesUIDocument
Set db=S.CurrentDatabase
Set uidoc=wk.currentdocument
Set doc=uidoc.document
Dim db90 As New notesdatabase(db.server,"Db2.nsf")
If Not db90.isopen Then
Call db90.Open( "", "" )
End If
If wk.DialogBox( "dialogbox900", True,True, False, False, False,False, "View Documents from Database2",doc) Then

If doc.Field1(0)<>"error" And doc.Field1(0)<>"" Then

UnivID=Strrightback( doc.Field1(0), "**") 
Set doc90 = db90.GetDocumentByUNID( Cstr(UnivID) )

Call wk.editdocument(False,doc90,True)

End If 'Error

End If 'Dialogbox
End Sub

The form "Dialogbox900" is in Database1 and have a list box ("Field1") with this formula to select some documents from a view in Database2 (form properties, 2nd tab):

server := @Subset(@DbName; 1);
tempvar := @DbLookup( "" : "NoCache" ; server : "db2.nsf" ; "ViewName" ; Key ; 1 );
@If(@IsError(tempvar); "Document not found|error";
@Text(@DbLookup( "" : "NoCache" ; server : "Db2.nsf" ; "ViewName" ; Key ; "dialogbox900" ))


In Database2 you have to add a column to a view (name of the column: "dialogbox900") with this code (column1 and 2, etc. are whatever information you have in this view):

@Text(column1)+"   "+@Text(column2)+@Repeat(" ";100)+"**"+@Text(@DocumentUniqueID)

Dig Deeper on Domino Resources - Part 5



  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/ community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury