Open a database based on the Replica ID

Hello,

I need to modify code written earlier. Several fields in a form require to fetch values from a view in a database (using @DbLookup) Example : @DbLookup(“”;“E52561EB:001EBF40”;“By View”;Field1;“Field2”)

The problem is, its accessing and getting details using the replica ID provided. I guess I do not have the connection document so, every time I try to compose the form, it asks for the server on which its residing. (A dialog list of servers pops up. Same for all the fields which are making use of a similar @DbLookup formula).

One thing that I noticed is that if I provide the server IP in the dialog list, it fetches the value. This IP happens to be the same server on which the application is residing. I do not understand which database is it getting the information from.

How do I find out which database is it accessing for the information based on the Replica ID mentioned?

Thanks in advance.

Subject: Open a database based on the Replica ID

“How do I find out which database is it accessing for the information based on the Replica ID mentioned?”

The Catalog (catalog.nsf) has a list of databases by Replica ID.

HTH.

Subject: RE: Open a database based on the Replica ID

Hello Gregg,

Thanks for the response. I searched all the database’s catalog which may be hosting this application but I found none.

Is there anyway that we can find out programmatically say, using Loutsscript or formula language. If you can quote some examples, that would be of great help.

Subject: RE: Open a database based on the Replica ID

This will get the DB, replace the db.server with a server name if you want, I also hard coded a rep ID…N.B. in LS you need to remove the colon in middle. You would probably want to loop across a bunch of servers…?

Sub Initialize

On Error Goto ErrorHandler



Dim s As New NotesSession

Dim db As NotesDatabase

Dim db_target As New NotesDatabase( "", "" )



Set db = s.CurrentDatabase



'//	Put whatever you need here

Call db_target.OpenByReplicaID( db.Server, "80257205002AD6BC" )



Msgbox db_target.FilePath

SimpleExit:

Exit Sub

ErrorHandler:

Msgbox {Error on line [} + Cstr( Erl() ) + {] } + Error

Resume SimpleExit

End Sub

Subject: RE: Open a database based on the Replica ID

Not sure if this will affect you…if you have a local replica, maybe replicas exist on multiple servers, some clustered, maybe not…be aware how the replica is found…from help:

If there are multiple copies of the database located on various Domino servers, using the database replica ID in place of both the server and database name lets you access a replica copy of that database without having to specify either the server name or the database name. For example, if you use “85255CEB:0032AC04” (a database replica ID, found in the database InfoBox) as the database name, Lotus Domino uses a replica of the database to retrieve the information.

Lotus Domino searches for replicas in this order, using the first replica it encounters:

Workspace

If there is one replica on your workspace, Lotus Domino uses it.

If there are multiple, stacked replicas on your workspace, Lotus Domino uses the replica on top of the stack.

If there are multiple, unstacked replicas on your workspace, Lotus Domino looks for an icon matching your current server and uses that. If none of the icons matches your current server, Lotus Domino uses the icon that was added to your workspace first.

Current server

Locally (your hard disk)

Once a replica is located, it’s added to your workspace to save time on future lookups.

Subject: Open a database based on the Replica ID

Thank you very much Nick…The example helped me a lot and I got to learn a couple of new things as well… :slight_smile: